@Test
    public void testMoreDuplicates() {
        final int targetSize = 100;
        final TinyIdentitySet<Integer> t = new TinyIdentitySet<>(3);
        final Integer[] instances = new Integer[targetSize];
        final List<Integer> add = buildSubSet(targetSize, t, instances);
        assertEquals(targetSize, t.size());
        t.addAll(add);
        assertEquals(targetSize, t.size());
    }
Check TinyIdentitySet seems to work. :)

@author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
vespajlib/src/test/java/com/yahoo/collections/TinyIdentitySetTestCase.java