Tagged articles
Reference Equality
11 articles · Page 1 of 1
The article explains that Java's Integer caching makes 1000 == 1000 false while 100 == 100 true, detailing how the IntegerCache works, why == compares references, and how reflection can expose the private cache array.
IntegerJavaReference Equality
0 likes · 3 min read

The article explains why comparing two Integer objects with `==` returns true for values within -128 to 127 but false for larger numbers, detailing Java’s integer cache, reference vs. value equality, and the correct use of `.equals()` to avoid subtle bugs.
AutoboxingJavaReference Equality
0 likes · 6 min read

Creating a String with new String("abc") can generate either one or two objects depending on whether the literal "abc" already exists in the JVM’s string constant pool, affecting object placement in the pool versus the heap and influencing reference equality comparisons.
Constant PoolJavaObject Creation
0 likes · 4 min read


ITPUBOct 13, 2024 · Backend Development
This article explains why the == operator yields false when comparing two Integer objects with the value 1000 but true for the value 100, covering Java's reference comparison, the IntegerCache mechanism, its performance rationale, and a reflective hack that can even make 2+2 equal 5.
IntegerJavaReference Equality
0 likes · 7 min read

This article explains how Java caches Integer objects in the range -128 to 127, why the == operator behaves differently for small and large integers, and demonstrates how to inspect and manipulate the cache using reflection.
Integer cachingJavaReference Equality
0 likes · 4 min read

This article explains why comparing Integer objects with == yields false for large values but true for small values due to Java's internal IntegerCache, demonstrates the caching mechanism with code examples, and shows how reflection can manipulate the cache, highlighting memory optimization considerations.
Integer cachingJavaReference Equality
0 likes · 4 min read

The article explains that Java's Integer objects use an internal cache for values between -128 and 127, causing equality checks with the == operator to return true for small numbers like 100 but false for larger numbers like 1000, and demonstrates how to inspect and manipulate this cache via reflection.
AutoboxingIntegerJava
0 likes · 5 min read

This article explains how a.equals(b) behaves when a or b is null or an empty string, compares it with Objects.equals, and analyzes the underlying source code to clarify the differences between reference equality (a==b) and logical equality (a.equals(b)) in Java.
JavaLogical EqualityNullPointerException
0 likes · 6 min read

This article explains why the == operator returns true for small Integer values in Java, detailing the internal IntegerCache mechanism, demonstrating the behavior with code examples, and showing how reflection can manipulate the cache, highlighting both the benefits and potential pitfalls of this optimization.
AutoboxingReference EqualityReflection
0 likes · 4 min read


21CTOOct 22, 2018 · Frontend Development
This article explains how JavaScript reference equality for objects and functions affects React's shallow prop and state comparison, shows common pitfalls that cause needless re‑renders, and provides practical techniques—such as defining functions outside components and caching event listeners—to dramatically improve rendering performance.
JavaScriptReactReference Equality
0 likes · 9 min read

Running simple Integer comparisons in Java reveals that values between -128 and 127 are cached, making identical literals share the same object, while larger numbers are distinct, and the article explains the underlying IntegerCache mechanism, its source code, and how reflection can alter it.
IntegerJavaReference Equality
0 likes · 4 min read
