Package net.openhft.collections

Examples of net.openhft.collections.SharedHashMap.containsKey()


     * containsKey returns true for contained key
     */
    @Test
    public void testContainsKey() throws IOException {
        SharedHashMap map = map5();
        assertTrue(map.containsKey(one));
        assertFalse(map.containsKey(zero));
    }

    /**
     * containsValue returns true for held values
View Full Code Here


     */
    @Test
    public void testContainsKey() throws IOException {
        SharedHashMap map = map5();
        assertTrue(map.containsKey(one));
        assertFalse(map.containsKey(zero));
    }

    /**
     * containsValue returns true for held values
     */
 
View Full Code Here

        SharedHashMap map = map5();
        Set s = map.entrySet();
        Object[] ar = s.toArray();
        assertEquals(5, ar.length);
        for (int i = 0; i < 5; ++i) {
            assertTrue(map.containsKey(((Map.Entry) (ar[i])).getKey()));
            assertTrue(map.containsValue(((Map.Entry) (ar[i])).getValue()));
        }
    }

    /**
 
View Full Code Here

     */
    @Test
    public void testPutIfAbsent() throws IOException {
        SharedHashMap map = map5();
        map.putIfAbsent(six, "Z");
        assertTrue(map.containsKey(six));
    }

    /**
     * putIfAbsent does not add the pair if the key is already present
     */
 
View Full Code Here

     */
    @Test
    public void testReplace() throws IOException {
        SharedHashMap map = map5();
        assertNull(map.replace(six, "Z"));
        assertFalse(map.containsKey(six));
    }

    /**
     * replace succeeds if the key is already present
     */
 
View Full Code Here

    @Test
    public void testRemove() throws IOException {
        SharedHashMap map = map5();
        map.remove(five);
        assertEquals(4, map.size());
        assertFalse(map.containsKey(five));
    }

    /**
     * remove(key,value) removes only if pair present
     */
 
View Full Code Here

    @Test
    public void testRemove2() throws IOException {
        SharedHashMap map = map5();
        map.remove(five, "E");
        assertEquals(4, map.size());
        assertFalse(map.containsKey(five));
        map.remove(four, "A");
        assertEquals(4, map.size());
        assertTrue(map.containsKey(four));
    }
View Full Code Here

        map.remove(five, "E");
        assertEquals(4, map.size());
        assertFalse(map.containsKey(five));
        map.remove(four, "A");
        assertEquals(4, map.size());
        assertTrue(map.containsKey(four));
    }

    /**
     * size returns the correct values
     */
 
View Full Code Here

     */
    @Test
    public void testContainsKey_NullPointerException() throws IOException {
        try {
            SharedHashMap c = newShmIntString(5);
            c.containsKey(null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.