Search in sources :

Example 1 with IntPerfectHash

use of org.h2.dev.hash.IntPerfectHash in project h2database by h2database.

the class TestIntPerfectHash method test.

private int test(byte[] desc, Set<Integer> set) {
    int max = -1;
    HashSet<Integer> test = new HashSet<>();
    IntPerfectHash hash = new IntPerfectHash(desc);
    for (int x : set) {
        int h = hash.get(x);
        assertTrue(h >= 0);
        assertTrue(h <= set.size() * 3);
        max = Math.max(max, h);
        assertFalse(test.contains(h));
        test.add(h);
    }
    return max;
}
Also used : IntPerfectHash(org.h2.dev.hash.IntPerfectHash) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IntPerfectHash (org.h2.dev.hash.IntPerfectHash)1