perf[cow]: CopyOnWriteHashMap equals and hashcode

This commit is contained in:
godotg
2024-07-02 12:56:05 +08:00
parent 7ae1971be9
commit 0c0dc62c2b
5 changed files with 29 additions and 12 deletions
@@ -270,15 +270,12 @@ public class ConcurrentArrayList<E> implements List<E> {
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
lock.lock();
try {
return list.equals(o);
} finally {
lock.unlock();
}
if (this != o) {
return false;
}
return list.equals(o);
}
@Override
@@ -133,4 +133,14 @@ public class CopyOnWriteHashMap<K, V> implements Map<K, V> {
public Set<Entry<K, V>> entrySet() {
return map.entrySet();
}
@Override
public boolean equals(Object o) {
return map.equals(o);
}
@Override
public int hashCode() {
return map.hashCode();
}
}
@@ -137,4 +137,14 @@ public class CopyOnWriteHashMapLongObject<V> implements Map<Long, V> {
public Set<Entry<Long, V>> entrySet() {
return map.entrySet();
}
@Override
public boolean equals(Object o) {
return map.equals(o);
}
@Override
public int hashCode() {
return map.hashCode();
}
}