mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-11 04:23:59 +00:00
feat[set]: 添加性能更加高的原生基础类型的固定大小set
This commit is contained in:
+19
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user