Tagged articles
Object Comparison
12 articles · Page 1 of 1
This article explains the clever trick of making a single object satisfy multiple equality checks in JavaScript using a mutable valueOf method, and shows how a similar effect can be achieved in Java through custom methods and state variables, highlighting the underlying mechanism.
JavaScriptMethod OverloadingObject Comparison
0 likes · 6 min read

This article explains how to make an object appear equal to two distinct values by exploiting the valueOf method in JavaScript and a custom equalsTo method in Java, showing step‑by‑step code examples and the underlying state‑changing logic.
JavaJavaScriptObject Comparison
0 likes · 6 min read

This article walks through the pain points of manually logging Java object changes, introduces the open‑source Equator library, explains its field‑ and getter‑based comparison strategies, shows how to integrate it via Maven, and demonstrates clean change‑log output with flexible field filtering and deep‑structure support.
BackendEquatorJava
0 likes · 8 min read

This article introduces Apache Commons Lang 3, explains its key utilities, and demonstrates how to integrate the library with Maven and employ DiffBuilder and ReflectionDiffBuilder to compare Java objects, generate detailed difference reports, and simplify debugging and testing processes.
Apache Commons LangDiffBuilderJava
0 likes · 9 min read


ITPUBDec 22, 2024 · Fundamentals
This article explains why using the == operator on two Integer objects in Java can yield true for some values and false for others, covering Integer caching, the role of Integer.valueOf, and the correct way to compare Integer values with equals.
IntegerJavaObject Comparison
0 likes · 7 min read

This article explains why using the == operator on two Java Integer objects can yield true for values between -128 and 127 but false for larger numbers, detailing the Integer cache mechanism, reference vs value comparison, and the proper use of equals for value equality.
IntegerJavaObject Comparison
0 likes · 6 min read

Many interviewees expect the Java expression ‘a == b’ to be false and ‘c == d’ true when using Integer objects, but due to the Integer cache range and JVM settings, both comparisons can actually return true, a nuance explained through source code analysis and cache configuration.
Integer cachingJVMJava
0 likes · 6 min read

This article explains why Java’s Integer autoboxing caches values between -128 and 127, causing the == operator to report true for those numbers, and shows how to avoid the pitfall by using equals() instead.
AutoboxingJavaObject Comparison
0 likes · 9 min read

These seven Java coding pitfalls—from improper object comparison and ternary‑operator null handling to generic type mismatches, BeanUtils copying errors, missing equals/hashCode, and CGLIB proxy issues—are explained with bytecode insights and concrete avoidance strategies such as consistent types, proper generics, correct overrides, and avoiding final members.
CGLIBGenericsJava
0 likes · 26 min read

This article explains how Java's String class encapsulates character arrays, the role of the string pool, the effects of the new operator, the intern() method, and the proper use of == versus equals() for reliable string comparison and memory optimization.
InternObject ComparisonString
0 likes · 8 min read

This article explains the purpose, differences, and proper usage of Java's hashCode() and equals() methods, offering clear interview guidance, performance considerations, and when to override them for reliable behavior in hash‑based collections.
BackendJavaObject Comparison
0 likes · 8 min read

This article explains Java's Integer and String comparison quirks, detailing how autoboxing caches values between -128 and 127, why '==' behaves differently for objects versus primitives, and demonstrates these concepts with clear code examples and explanations.
AutoboxingCachingInteger
0 likes · 7 min read
