Why does the JVM allow to set the “high” value for the IntegerCache, but not the “low”?

吃可爱长大的小学妹 提交于 2019-12-01 14:58:42

Found out that there is already an unresolved RFP on this.

Joe Darcy commented on the issue :

It is conceivable that it would be helpful to cache a greater range of negative number as well, but as of yet there has been no pressing need to do so.

Note that the RFP offer a poor workaround if ever someone was interested in using this before it is handled :

No workaround possible for increasing the size of the cache apart from Implementing your own cache and reffering to this first before going to the java.lang.Integer class. This is obviously not good as it requires calls to other classes rather than just the default use of the Integer.valueOf(int i) call.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!