feat[buffer]: 使用primitive type的高性能set

This commit is contained in:
godotg
2022-09-24 18:15:11 +08:00
parent 18652f366d
commit 438d4894ca
2 changed files with 14 additions and 15 deletions
@@ -49,19 +49,18 @@ public class FixedCollectionTest {
@Test
public void testFixedHashInt() {
var list = new FixedSizeListInt(3);
list.set(0, 1);
list.set(1, 2);
list.set(2, 4);
var set = new FixedHashSetInt(list);
public void testHashIntSet() {
var set = new HashIntSet(3);
set.add(1);
set.add(2);
set.add(3);
for (int i = 0; i < set.size(); i++) {
for (var ele : set) {
// test iterator
}
}
Assert.assertTrue(set.contains(4));
Assert.assertTrue(set.contains(3));
}
}