Integer的自动拆箱装箱解析
IntegerCache
IntegerCache是Integer类中的静态内部类,用于缓存数据便于节省内存、提高性能。下面给出IntegerCache的源码:
/**
* Cache to support the object identity semantics of autoboxing for values between
* -128 and 127 (inclusive) as required by JLS.
*
* The cache is initialized on first usage. The size of the cache
* may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option.
* During VM initialization, java.lang.Integer.IntegerCache.high property
* may be set and saved in the private system properties in the
* sun.misc.VM class.
*/
private