use of org.h2.dev.hash.MinimalPerfectHash in project h2database by h2database.
the class TestPerfectHash method testMinimal.
private <K> int testMinimal(byte[] desc, Set<K> set, UniversalHash<K> hf) {
int max = -1;
BitSet test = new BitSet();
MinimalPerfectHash<K> hash = new MinimalPerfectHash<>(desc, hf);
for (K x : set) {
int h = hash.get(x);
assertTrue(h >= 0);
assertTrue(h <= set.size() * 3);
max = Math.max(max, h);
assertFalse(test.get(h));
test.set(h);
}
return max;
}
Aggregations