Package org.rssowl.core.internal.persist

Examples of org.rssowl.core.internal.persist.LongHashSet


            set.add(r.nextLong());
        return set;
    }

    private LongHashSet createFromJavaSet() {
        LongHashSet set = new LongHashSet();
        for (Long element : javaSet)
            set.add(element);
        return set;
    }
View Full Code Here


        return set;
    }

    @Test
    public void testAddAndContainsWith0ExpectedSize() {
        LongHashSet set = new LongHashSet(0);
        assertAddAndContains(set);
    }
View Full Code Here

        assertAddAndContains(set);
    }

    @Test
    public void testAddAndContainsWithExpectedSize() {
        LongHashSet set = new LongHashSet(500);
        assertAddAndContains(set);
    }
View Full Code Here

        assertAddAndContains(set);
    }

    @Test
    public void testAddAndContains() {
        LongHashSet set = new LongHashSet();
        assertAddAndContains(set);
    }
View Full Code Here

        }
    }

    @Test
    public void testAddAbsentOnExisting() {
        LongHashSet set = createFromJavaSet();
        int size = javaSet.size();
        for (long element : generateAbsent()) {
            set.add(element);
            assertEquals(++size, set.size());
            assertTrue(set.contains(element));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testAddOnExisting() {
        LongHashSet set = createFromJavaSet();
        for (long element : javaSet) {
            set.add(element);
            assertEquals(javaSet.size(), set.size());
            assertTrue(set.contains(element));
        }
    }
View Full Code Here

    }

    @Test
    public void testContainsAbsent() {
        Set<Long> generated = generateAbsent();
        LongHashSet set = createFromJavaSet();

        for (long element : generated)
          assertFalse(set.contains(element));
    }
View Full Code Here

          assertFalse(set.contains(element));
    }

    @Test
    public void testContainsFromEmpty() {
        LongHashSet set = new LongHashSet();
        assertFalse(set.contains(5));
        assertFalse(set.contains(0));
        assertFalse(set.contains(50));
    }
View Full Code Here

        assertFalse(set.contains(50));
    }

    @Test
    public void testRemove() {
        LongHashSet set = createFromJavaSet();
        int setSize = javaSet.size();
        assertEquals(setSize, set.size());
        for (long element : javaSet) {
            set.remove(element);
            assertEquals(--setSize, set.size());
            assertFalse(set.contains(element));
        }

        /* Ensure that add and get still work correctly after removals */
        assertAddAndContains(set);
    }
View Full Code Here

    }

    /* This time only remove some entries */
    @Test
    public void testRemove2() {
        LongHashSet set = createFromJavaSet();
        int setSize = javaSet.size();
        int count = 0;
        Set<Long> keysInSet = new HashSet<Long>(javaSet);
        for (long element : javaSet) {
            keysInSet.remove(element);
            set.remove(element);
            assertEquals(--setSize, set.size());
            assertFalse(set.contains(element));
            if (count++ > 5)
                break;
        }

        /* Ensure that add and get still work correctly after removals */
 
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.persist.LongHashSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.