Skip to content

Commit 09f1c9f

Browse files
committed
perf[set]: add unboxed contains method to HashSetInt
1 parent 4addf11 commit 09f1c9f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

protocol/src/main/java/com/zfoo/protocol/collection/HashSetInt.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public boolean contains(Object o) {
5353
return map.containsKey(o);
5454
}
5555

56+
public boolean contains(int key) {
57+
return map.containsKey(key);
58+
}
59+
5660
@Override
5761
public boolean add(Integer e) {
5862
return map.put(e, Boolean.TRUE) == null;

protocol/src/main/java/com/zfoo/protocol/collection/HashSetShort.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public boolean contains(Object o) {
5353
return map.containsKey(o);
5454
}
5555

56+
public boolean contains(short key) {
57+
return map.containsKey(key);
58+
}
59+
5660
@Override
5761
public boolean add(Short e) {
5862
return map.put(e, Boolean.TRUE) == null;

0 commit comments

Comments
 (0)