perf[set]: add unboxed contains method to HashSetInt

This commit is contained in:
jaysunxiao committed 2025-07-05 10:33:46 +08:00
1 parent 4addf11543
commit 09f1c9fd70
2 files changed
+8

No files matched your search

@@ -53,6 +53,10 @@ public class HashSetInt extends AbstractSet<Integer> {
return map.containsKey(o);
}
public boolean contains(int key) {
return map.containsKey(key);
}
@Override
public boolean add(Integer e) {
return map.put(e, Boolean.TRUE) == null;
@@ -53,6 +53,10 @@ public class HashSetShort extends AbstractSet<Short> {
return map.containsKey(o);
}
public boolean contains(short key) {
return map.containsKey(key);
}
@Override
public boolean add(Short e) {
return map.put(e, Boolean.TRUE) == null;