摘要:
JDK的源码,看看到Integer.ValueOf(int)里面做了什么优化:public static Integer valueOf(int i) { final int offset = 128; if (i >= -128 && i <= 127) { // must cache return IntegerCache.cache[i + offset]; } return new Integer(i);} private static class IntegerCache { private IntegerCache(){} static final In 阅读全文