Integer Autoboxing Cache Pitfall

Integer.valueOf caches instances for -128 to 127 (JLS). == on boxed Integers compares references, not values. Outside cache range, two equal Integer objects...

Integer Autoboxing Cache Pitfall · Home · Support the platform