#1229 - Implement equals and hashCode on ModifyAwareMap, ModifyAwareList and ModifyAwareSet

This commit is contained in:
Rob Bygrave
2018-01-06 12:51:50 +13:00
parent db5db26fca
commit 3c7ef7d46e
6 changed files with 172 additions and 66 deletions
@@ -2,6 +2,7 @@ package io.ebeaninternal.json;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
/**
@@ -51,6 +52,19 @@ public class ModifyAwareSet<E> implements Set<E>, ModifyAwareOwner {
return set.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ModifyAwareSet)) return false;
ModifyAwareSet<?> that = (ModifyAwareSet<?>) o;
return Objects.equals(set, that.set);
}
@Override
public int hashCode() {
return Objects.hash(set);
}
@Override
public boolean add(E o) {
if (set.add(o)) {