diff --git a/client/src/com/aerospike/client/Record.java b/client/src/com/aerospike/client/Record.java index f2d1293fb..1d8434ba3 100644 --- a/client/src/com/aerospike/client/Record.java +++ b/client/src/com/aerospike/client/Record.java @@ -284,23 +284,13 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { + if (obj == null || getClass() != obj.getClass()) { return false; } Record other = (Record) obj; - if (expiration != other.expiration) { - return false; - } - if (generation != other.generation) { - return false; - } - if (bins == null) { - return other.bins == null; - } else { - return bins.equals(other.bins); - } + // Compare primitives first (cheap), then bins using null-safe Objects.equals. + return this.expiration == other.expiration && + this.generation == other.generation && + Objects.equals(this.bins, other.bins); } }