Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions client/src/com/aerospike/client/Value.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,21 @@ public String toString() {

@Override
public boolean equals(Object other) {
return (other != null &&
this.getClass().equals(other.getClass()) &&
this.value.equals(((StringValue)other).value));
// Fast path: same reference
if (this == other) {
return true;
}
// Null check
if (other == null) {
return false;
}
// Ensure exact same runtime class (preserve original semantics)
if (this.getClass() != other.getClass()) {
return false;
}
// Safe cast and value comparison
StringValue o = (StringValue) other;
return this.value.equals(o.value);
}

@Override
Expand Down