Tagged articles
10 articles
Page 1 of 1
DevOps Coach
DevOps Coach
Dec 27, 2025 · Fundamentals

Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache

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.

AutoboxingInteger cacheJava
0 likes · 6 min read
Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache
ITPUB
ITPUB
Oct 13, 2024 · Backend Development

Why Does 1000==1000 Return False but 100==100 Return True in Java?

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.

JavaReference EqualityReflection
0 likes · 7 min read
Why Does 1000==1000 Return False but 100==100 Return True in Java?
Architecture Digest
Architecture Digest
Sep 12, 2023 · Fundamentals

Understanding Java Integer Caching and the == Operator

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.

JavaMemory OptimizationReference Equality
0 likes · 4 min read
Understanding Java Integer Caching and the == Operator
Java Captain
Java Captain
Mar 1, 2022 · Fundamentals

Understanding Java Integer Caching and the == Operator

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.

JavaMemory OptimizationReference Equality
0 likes · 4 min read
Understanding Java Integer Caching and the == Operator
Top Architect
Top Architect
Jan 2, 2022 · Backend Development

Understanding Java Integer Caching: Why 1000 == 1000 Is False but 100 == 100 Is True

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.

AutoboxingJavaReference Equality
0 likes · 5 min read
Understanding Java Integer Caching: Why 1000 == 1000 Is False but 100 == 100 Is True
Programmer DD
Programmer DD
Sep 16, 2020 · Backend Development

Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache

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.

AutoboxingInteger cacheReference Equality
0 likes · 4 min read
Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache
21CTO
21CTO
Oct 22, 2018 · Frontend Development

Stop Unnecessary React Re‑renders: Cache Event Handlers and Master Reference Equality

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
Stop Unnecessary React Re‑renders: Cache Event Handlers and Master Reference Equality