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
11 changes: 10 additions & 1 deletion client/src/com/aerospike/client/Value.java
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,8 @@ public long toLong() {
* GeoJSON value.
*/
public static final class GeoJSONValue extends Value {
private Integer cachedHash = null;

private final String value;

public GeoJSONValue(String value) {
Expand Down Expand Up @@ -1348,7 +1350,14 @@ public boolean equals(Object other) {

@Override
public int hashCode() {
return value.hashCode();
Integer h = cachedHash;
if (h == null) {
// Compute and cache. If value is null, this will throw NPE here,
// matching original behavior of throwing when hashCode() is invoked.
h = Integer.valueOf(value.hashCode());
cachedHash = h;
}
return h.intValue();
}
}

Expand Down