Package net.openhft.collections

Examples of net.openhft.collections.SharedHashMap


    /**
     * clear removes all pairs
     */
    @Test
    public void testClear() throws IOException {
        SharedHashMap map = map5();
        map.clear();
        assertEquals(0, map.size());
    }
View Full Code Here


    /**
     * Maps with same contents are equal
     */
    @Test
    public void testEquals() throws IOException {
        SharedHashMap map1 = map5();
        SharedHashMap map2 = map5();
        assertEquals(map1, map2);
        assertEquals(map2, map1);
        map1.clear();
        assertFalse(map1.equals(map2));
        assertFalse(map2.equals(map1));
    }
View Full Code Here

    /**
     * contains returns true for contained value
     */
    @Test
    public void testContains() throws IOException {
        SharedHashMap map = map5();
        assertTrue(map.containsValue("A"));
        assertFalse(map.containsValue("Z"));
    }
View Full Code Here

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

    /**
     * containsValue returns true for held values
     */
    @Test
    public void testContainsValue() throws IOException {
        SharedHashMap map = map5();
        assertTrue(map.containsValue("A"));
        assertFalse(map.containsValue("Z"));
    }
View Full Code Here

     * get returns the correct element at the given key,
     * or null if not present
     */
    @Test
    public void testGet() throws IOException {
        SharedHashMap map = map5();
        assertEquals("A", (String) map.get(one));
        SharedHashMap empty = newShmIntString();
        assertNull(map.get(notPresent));
    }
View Full Code Here

    /**
     * isEmpty is true of empty map and false for non-empty
     */
    @Test
    public void testIsEmpty() throws IOException {
        SharedHashMap empty = newShmIntString();
        SharedHashMap map = map5();
        assertTrue(empty.isEmpty());
        assertFalse(map.isEmpty());
    }
View Full Code Here

    /**
     * keySet returns a Set containing all the keys
     */
    @Test
    public void testKeySet() throws IOException {
        SharedHashMap map = map5();
        Set s = map.keySet();
        assertEquals(5, s.size());
        assertTrue(s.contains(one));
        assertTrue(s.contains(two));
        assertTrue(s.contains(three));
        assertTrue(s.contains(four));
View Full Code Here

    /**
     * keySet.toArray returns contains all keys
     */
    @Test
    public void testKeySetToArray() throws IOException {
        SharedHashMap map = map5();
        Set s = map.keySet();
        Object[] ar = s.toArray();
        assertTrue(s.containsAll(Arrays.asList(ar)));
        assertEquals(5, ar.length);
        ar[0] = m10;
        assertFalse(s.containsAll(Arrays.asList(ar)));
View Full Code Here

    /**
     * Values.toArray contains all values
     */
    @Test
    public void testValuesToArray() throws IOException {
        SharedHashMap map = map5();
        Collection v = map.values();
        Object[] ar = v.toArray();
        ArrayList s = new ArrayList(Arrays.asList(ar));
        assertEquals(5, ar.length);
        assertTrue(s.contains("A"));
        assertTrue(s.contains("B"));
View Full Code Here

TOP

Related Classes of net.openhft.collections.SharedHashMap

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.