@Test
    public void testMuckingAbout() {
        final int targetSize = 100;
        final TinyIdentitySet<Integer> t = new TinyIdentitySet<>(3);
        final Integer[] instances = new Integer[targetSize];
        final List<Integer> retain = buildSubSet(targetSize, t, instances);
        for (final Integer n : retain) {
            t.remove(n);
            assertEquals(targetSize - 1, t.size());
            t.add(n);
            assertEquals(targetSize, t.size());
        }
        assertEquals(targetSize, t.size());
        final Integer[] contents = t.toArray(new Integer[0]);
        Arrays.sort(contents, 0, targetSize);
        for (int i = 0; i < targetSize; ++i) {
            assertEquals(instances[i], contents[i]);
        }
    }
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