Topic

Objects.equals

Collection size
2 articles
Page 1 of 1
IT Services Circle
IT Services Circle
Mar 30, 2022 · Fundamentals

Understanding Objects.equals and Common Pitfalls in Java Equality Checks

This article explains how Java's Objects.equals works, compares it with the == operator and the equals method of primitive wrappers, demonstrates typical null‑pointer and type‑mismatch pitfalls, and provides practical code examples and solutions for reliable value comparison.

EqualityJavaNullPointerException
0 likes · 14 min read
Understanding Objects.equals and Common Pitfalls in Java Equality Checks
Java Captain
Java Captain
Jun 6, 2021 · Fundamentals

Understanding the Differences Between a.equals(b) and Objects.equals(a, b) in Java

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
Understanding the Differences Between a.equals(b) and Objects.equals(a, b) in Java