Tag

equals vs ==

1 views collected around this technical thread.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Nov 10, 2020 · Fundamentals

Understanding Java Integer Caching and the Pitfalls of Using == vs equals

This article explains Java's Integer caching mechanism, why using == on wrapper objects can be misleading outside the -128 to 127 range, shows how to control the cache size with JVM options, and demonstrates bytecode inspection with javap to reveal the underlying valueOf calls.

JVM optionsJavaJavap
0 likes · 5 min read
Understanding Java Integer Caching and the Pitfalls of Using == vs equals
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Mar 11, 2020 · Fundamentals

Understanding Java Integer Caching and Autoboxing: When == Can Mislead

This article explains Java's Integer caching mechanism, why using == to compare wrapper objects can produce unexpected results, how the IntegerCache works, how to adjust its range with JVM options, and demonstrates the behavior through code examples and javap decompilation.

JavaJavapPerformance
0 likes · 7 min read
Understanding Java Integer Caching and Autoboxing: When == Can Mislead