feat[set]: 添加性能更加高的原生基础类型的固定大小set

This commit is contained in:
godotg
2022-09-23 22:51:56 +08:00
parent 8783790724
commit e540fa13db
9 changed files with 911 additions and 1 deletions
@@ -12,13 +12,14 @@
package com.zfoo.protocol.collection;
import org.junit.Assert;
import org.junit.Test;
/**
* @author godotg
* @version 3.0
*/
public class ListTest {
public class FixedCollectionTest {
@Test
public void testFixedSizeListInt() {
@@ -46,4 +47,21 @@ public class ListTest {
}
}
@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);
for (int i = 0; i < set.size(); i++) {
for (var ele : set) {
// test iterator
}
}
Assert.assertTrue(set.contains(4));
}
}