logoalt Hacker News

agilobtoday at 8:17 AM1 replyview on HN

> Integers from -127 <-> 127

The cache can be extended on startup with env var `java.lang.Integer.IntegerCache.high `

https://github.com/openjdk/jdk/blob/cc278dbb8a1ca0754d584270...


Replies

pwaglandtoday at 8:48 AM

That is a nice piece piece of knowledge! We have an Integer cache in our product, and the only reason that it hangs around is that it caches 0..1024 instead of -127..128. By setting this value, we could simplify our code, ever so slightly.