| ▲ | wpollock 2 days ago | |||||||
> But it uses flyweight instances for values up to 256, so in Java, whether two Integers with the same numeric value are equal according to the = operator depends on what that value is. ... I believe Java caches Integer objects for values -128..+128, not 256. But that may be an implementation detail, and not something to count on. | ||||||||
| ▲ | bunderbunder 2 days ago | parent | next [-] | |||||||
No, you’re right. I misremembered. | ||||||||
| ||||||||
| ▲ | gf000 2 days ago | parent | prev [-] | |||||||
And since java 28's value types, == will work identically for all Integers, finally. | ||||||||
| ||||||||