@Test
    public void testAdd() {
        final String string = "abc";
        final String a = new String(string);
        final String b = new String(string);
        final TinyIdentitySet<String> t = new TinyIdentitySet<>(3);
        t.add(a);
        t.add(b);
        assertEquals(2, t.size());
        t.add(string);
        assertEquals(3, t.size());
        t.add(string);
        t.add(a);
        t.add(b);
        assertEquals(3, 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