Package edu.stanford.ppl.concurrent

Examples of edu.stanford.ppl.concurrent.SnapTreeMap


                  new ConcurrentSkipListSet());
        lockSteps(new TreeSet(reverseOrder()),
                  new ConcurrentSkipListSet(reverseOrder()));

        lockSteps(new TreeMap(),
                  new SnapTreeMap());
        lockSteps(new TreeMap(reverseOrder()),
                  new SnapTreeMap(reverseOrder()));
    }
View Full Code Here


    /**
     * Create a map from Integers 1-5 to Strings "A"-"E".
     */
    private static SnapTreeMap map5() {
        SnapTreeMap map = new SnapTreeMap();
        assertTrue(map.isEmpty());
        map.put(one, "A");
        map.put(five, "E");
        map.put(three, "C");
        map.put(two, "B");
        map.put(four, "D");
        assertFalse(map.isEmpty());
        assertEquals(5, map.size());
        return map;
    }
View Full Code Here

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

    /**
     *
     */
    public void testConstructFromSorted() {
        SnapTreeMap map = map5();
        SnapTreeMap map2 = new SnapTreeMap(map);
        assertEquals(map, map2);
    }
View Full Code Here

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

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

    /**
     *  containsValue returns true for held values
     */
    public void testContainsValue() {
        SnapTreeMap 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
     */
    public void testGet() {
        SnapTreeMap map = map5();
        assertEquals("A", (String)map.get(one));
        SnapTreeMap empty = new SnapTreeMap();
        assertNull(empty.get(one));
    }
View Full Code Here

    /**
     *  isEmpty is true of empty map and false for non-empty
     */
    public void testIsEmpty() {
        SnapTreeMap empty = new SnapTreeMap();
        SnapTreeMap map = map5();
        assertTrue(empty.isEmpty());
        assertFalse(map.isEmpty());
    }
View Full Code Here

    /**
     *   firstKey returns first key
     */
    public void testFirstKey() {
        SnapTreeMap map = map5();
        assertEquals(one, map.firstKey());
    }
View Full Code Here

TOP

Related Classes of edu.stanford.ppl.concurrent.SnapTreeMap

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.