Tagged articles
hashCode
42 articles · Page 1 of 1
The article explains what Lombok’s @Data annotation expands to, warns that its default @EqualsAndHashCode callSuper is false causing equals/hashCode to ignore superclass fields, discusses the need to manually declare serialVersionUID for Serializable classes, and recommends using @Getter/@Setter with explicit @EqualsAndHashCode when inheritance is involved.
JavaLombokdata
0 likes · 5 min read

The article explains Java's Object class as the root of all classes, details its fundamental methods such as clone, equals, hashCode, toString, finalize and getClass, illustrates shallow vs. deep copying, shows how to override equals with a Book example, and warns about using finalize for cleanup.
CloneFinalizeJava
0 likes · 10 min read

The article explains the contract between equals and hashCode in Java, shows what goes wrong when only one is overridden, demonstrates the correct implementation with Objects.equals and Objects.hash, covers IDE/Lombok generation, JPA entity nuances, inheritance pitfalls, records, and common anti‑patterns.
Best PracticesHashMapJPA
0 likes · 9 min read

The article explains why a HashMap lookup can return null even when key objects have identical fields, showing that the default equals and hashCode implementations compare memory addresses, and demonstrates how overriding both methods fixes the issue and avoids real‑world bugs.
CachingHashMapJava
0 likes · 8 min read

A senior architect introduced a high‑concurrency monitoring feature that used ConcurrentHashMap, but missing equals/hashCode and non‑atomic updates caused massive memory leaks and race conditions, leading to a post‑mortem that highlights proper key implementation, atomic map operations, and cautious synchronization.
ConcurrencyConcurrentHashMapJava
0 likes · 7 min read

This guide explains the fundamental distinction between Java's == operator and the equals() method, covering primitive vs. reference comparisons, default implementations, common pitfalls like string interning and Integer caching, and the essential contract with hashCode for reliable object equality.
InterviewOperatorequality
0 likes · 7 min read

This article breaks down Java's Object class, detailing its twelve core methods—including equals, hashCode, clone, getClass, notify, notifyAll, and the various wait overloads—providing clear explanations, usage examples, and best‑practice guidelines for developers.
CloneFinalizeJava
0 likes · 4 min read

This article explains the purpose and contract of Java's equals and hashCode methods, shows how the default implementations work, demonstrates why String overrides equals, outlines the three-step equality check, and provides guidelines for correctly overriding these methods in custom classes.
JavaObjectcollections
0 likes · 7 min read


ITPUBNov 27, 2025 · Backend Development
A popular claim that changing a Java field name from "userName" to "usrNme" can cut API latency by dozens of milliseconds is examined, revealing why hashCode calculations, reflection, and caching have negligible impact compared to real bottlenecks like I/O, GC, and thread scheduling.
JavaReflectionSpringBoot
0 likes · 5 min read

A skeptical look at the claim that renaming Java fields to shorter, random names can dramatically improve API latency, examining benchmark data, the actual cost of String.hashCode, reflection mechanics, and the real factors that affect backend performance.
JavaReflectionbackend development
0 likes · 5 min read

The article debunks a sensational claim that changing a Java field name can dramatically improve API latency, showing benchmark data, analyzing String.hashCode implementation, reflection overhead, and explaining why such naming tweaks have negligible impact compared to real performance bottlenecks.
BackendJavaReflection
0 likes · 5 min read

This article explains Java’s hashCode method, its role in hash-based collections like HashMap and HashSet, how objects are placed in buckets, the necessity of overriding hashCode alongside equals, and how proper implementation improves performance and ensures consistent behavior.
HashMapJavadata structures
0 likes · 3 min read

A senior architect introduced a high‑concurrency monitoring feature that used a ConcurrentHashMap without proper equals/hashCode implementations, leading to duplicate keys, race conditions, and severe memory leaks, which were later resolved by correcting the key class and applying atomic map operations.
ConcurrentHashMapJavaMemoryLeak
0 likes · 8 min read

Using JMH, this article benchmarks Java switch statements, comparing the traditional int‑based switch (via String hashCode) against the newer String‑based switch, showing that the int version runs roughly twice as fast while warning about hashCode collisions.
hashCodeperformanceswitch
0 likes · 6 min read

The default Java object hashCode() implementation is immutable and unchanged by garbage collection, while custom overrides must keep contributing fields constant to avoid map errors, and the OpenJDK native implementation stores the hash in the object header using a Marsaglia XORshift algorithm.
JVMJavaOpenJDK
0 likes · 3 min read

This article explains why Java's Float values 0.0 and -0.0 have different hashCode results, how that affects their use as Map keys, and demonstrates the underlying IEEE‑754 representation and related debugging steps with concrete code examples.
IEEE754floathashCode
0 likes · 9 min read

This article explains how Java's Float hashCode treats 0.0 and -0.0 as distinct values, causing unexpected behavior when using floating‑point numbers as HashMap keys, and shows how to debug, reproduce, and avoid the issue by using alternative representations.
HashMapIEEE754float
0 likes · 10 min read

This article explains why Java developers must override both hashCode() and equals() methods for proper object comparison in hash-based collections, outlines the scenarios requiring such overrides, and provides detailed example code demonstrating correct implementations.
HashSetJavaObject
0 likes · 7 min read

This article explains the purpose of Java's hashCode() and equals() methods, outlines the rules for overriding them, demonstrates common pitfalls with HashSet through a concrete code example, and clarifies why both methods must be overridden when using custom objects as HashMap keys.
HashMapHashSetJava
0 likes · 6 min read

This article explores the distinction between OutOfMemory errors and memory leaks in Java, examines how improper use of static fields, unclosed streams, incorrect equals/hashCode implementations, and ThreadLocal can cause leaks, and provides practical solutions and tools such as JVisualVM to detect and prevent these issues.
JVMJavaMemory Leak
0 likes · 16 min read

This article explains the concept of absolute value, demonstrates Java's Math.abs overloads for different primitive types, illustrates a common hashing use‑case that can fail when Integer.MIN_VALUE is processed, and shows how casting to long resolves the overflow problem.
Longabsolute-valuehashCode
0 likes · 5 min read

This article explains why a Java object's hashCode remains unchanged after garbage‑collection moves it, detailing the hashCode contract, JVM header storage, OpenJDK generation strategies, identityHashCode behavior, and practical JOL experiments that illustrate the underlying mechanisms.
BackendGCJOL
0 likes · 13 min read

This article explains the relationship between Java's equals and hashCode methods, outlines their contractual requirements, shows how the default implementations work, demonstrates proper overrides with code examples, and provides practical guidelines for implementing robust hashCode functions to ensure correct behavior in hash‑based collections.
HashMapJavaObject
0 likes · 11 min read

This article explains the rules and design principles behind Java's hashCode() and equals() methods, illustrates their implementations in String, and provides concrete Person class examples showing how proper overriding affects Set and Map behavior.
Design PrinciplesJavaequals
0 likes · 10 min read

This article explains the roles of equals() and hashCode() in Java, demonstrates how their interaction affects hash‑based collections like HashSet, provides multiple code examples showing correct and incorrect implementations, and outlines essential principles for overriding these methods to ensure proper object equality handling.
HashSetJavaObject Equality
0 likes · 9 min read

This article explains how HashMap stores data using hash functions, illustrates hash collisions and chain addressing, and demonstrates why overriding hashCode and equals in custom key classes is essential for correct retrieval, using Java code examples and interview insights.
BackendHashMapInterview
0 likes · 9 min read

A newly hired architect boasts high‑concurrency expertise but writes un‑commented Java code that misuses ConcurrentHashMap, leading to memory leaks; the ensuing investigation reveals missing equals/hashCode implementations, race conditions in a visit method, and a debate between synchronized blocks and putIfAbsent for safe updates.
ConcurrentHashMapJavaMemory Leak
0 likes · 8 min read

This article explores the distinction between OutOfMemory errors and memory leaks in Java, explains how improper use of static fields, unclosed streams, incorrect equals/hashCode implementations, and ThreadLocal can lead to leaks, and provides practical solutions and tools such as JVisualVM to detect and prevent them.
JVMMemory LeakOutOfMemory
0 likes · 14 min read

This article explains how HashMap stores data using hash functions, illustrates the impact of hash collisions, and demonstrates with Java code why custom objects used as keys must override both hashCode and equals to work correctly in interviews and real projects.
InterviewequalshashCode
0 likes · 9 min read

This article provides a comprehensive overview of Java's HashMap, covering its place in the Set and Map families, internal implementation details, the relationship between hashCode() and equals(), collision resolution strategies, basic operations, differences from Hashtable, and several classic interview problems such as Top‑K frequency and LRU cache design.
CollisionHashMapInterview
0 likes · 14 min read

This article explains the fundamentals of hash tables, dives deep into Java's HashMap implementation—including JDK7 source code analysis of its internal structures, resizing logic, and key methods—while also covering common interview questions such as why the array size must be a power of two and the necessity of overriding both equals and hashCode.
HashMapInterviewJDK7
0 likes · 19 min read

This article explores the rationale behind Java's String.hashCode method using the multiplier 31, detailing its implementation, mathematical justification, performance optimizations, and experimental analysis of hash collision rates with various multipliers, concluding why 31 is an optimal choice.
collision analysishashCodeprime multiplier
0 likes · 15 min read

This article explains why Java's String.hashCode() uses the multiplier 31, covering its implementation, mathematical justification, JVM optimization, comparative analysis with other multipliers, and experimental results on hash collision rates and distribution using a large English word dataset.
AlgorithmJavahashCode
0 likes · 15 min read

This article explains why Java’s String.hashCode method multiplies by 31, covering the mathematical derivation, prime‑number benefits, JVM optimization tricks, and experimental results that compare 31 with other multipliers on a large word list.
Javahash functionhashCode
0 likes · 14 min read

This article explains the contract between hashCode() and equals() in Java, shows the problems caused by violating it—such as incorrect behavior in HashMap/HashSet and memory leaks—and provides practical guidelines and code examples for implementing robust hashCode methods, including the use of Apache's HashCodeBuilder.
HashMapHashSetImmutable Objects
0 likes · 15 min read

This article explains the contract of equals and hashCode in Java, shows what goes wrong when only equals is overridden, provides a vivid house‑ownership analogy, and offers practical guidelines and code examples for correctly overriding both methods.
JavaObjectbackend development
0 likes · 5 min read

The article explains how HashMap stores data using hash functions, illustrates hash collisions and chain addressing, and demonstrates through Java code why overriding both hashCode and equals in custom key classes is essential for correct retrieval from a HashMap.
HashMapInterviewJava
0 likes · 10 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 the fundamentals of binary operations, why hashCode is used, how Java's String hashCode is implemented, the rationale behind using the multiplier 31, and the detailed workings of HashMap's hash function, index calculation, capacity choices, and custom sizing recommendations.
HashMapdata structureshash algorithm
0 likes · 13 min read

This article presents a collection of essential Java programming practices, covering how to correctly implement equals, hashCode, compareTo, clone, use StringBuilder, generate random numbers, manage threads, handle I/O with try‑finally, perform defensive checks, and manipulate arrays and primitive packing.
Best PracticesClonecollections
0 likes · 14 min read

This article explains the default implementations of Java's Object.equals() and Object.hashCode(), the required contracts for overriding them, demonstrates their behavior in the String class, and provides practical guidelines and example code for correctly overriding these methods in custom classes.
@OverrideObjectString
0 likes · 11 min read

This article explains how Java's default equals() compares object references, why overriding both equals() and hashCode() is required for correct behavior in collections like HashMap, and demonstrates the proper implementations with code examples and a detailed look at HashMap's internal mechanics.
HashMapJavaequals
0 likes · 11 min read
