Examples of SnapTreeMap


Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * entrySet contains all pairs
     */
    public void testEntrySet() {
        SnapTreeMap map = map5();
        Set s = map.entrySet();
        assertEquals(5, s.size());
        Iterator it = s.iterator();
        while (it.hasNext()) {
            Map.Entry e = (Map.Entry) it.next();
            assertTrue(
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * descendingEntrySet contains all pairs
     */
    public void testDescendingEntrySet() {
        SnapTreeMap map = map5();
        Set s = map.descendingMap().entrySet();
        assertEquals(5, s.size());
        Iterator it = s.iterator();
        while (it.hasNext()) {
            Map.Entry e = (Map.Entry) it.next();
            assertTrue(
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *  entrySet.toArray contains all entries
     */
    public void testEntrySetToArray() {
        SnapTreeMap 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

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *  descendingEntrySet.toArray contains all entries
     */
    public void testDescendingEntrySetToArray() {
        SnapTreeMap map = map5();
        Set s = map.descendingMap().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

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   putAll  adds all key-value pairs from the given map
     */
    public void testPutAll() {
        SnapTreeMap empty = new SnapTreeMap();
        SnapTreeMap map = map5();
        empty.putAll(map);
        assertEquals(5, empty.size());
        assertTrue(empty.containsKey(one));
        assertTrue(empty.containsKey(two));
        assertTrue(empty.containsKey(three));
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   putIfAbsent works when the given key is not present
     */
    public void testPutIfAbsent() {
        SnapTreeMap map = map5();
        map.putIfAbsent(six, "Z");
        assertTrue(map.containsKey(six));
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   putIfAbsent does not add the pair if the key is already present
     */
    public void testPutIfAbsent2() {
        SnapTreeMap map = map5();
        assertEquals("A", map.putIfAbsent(one, "Z"));
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   replace fails when the given key is not present
     */
    public void testReplace() {
        SnapTreeMap map = map5();
        assertNull(map.replace(six, "Z"));
        assertFalse(map.containsKey(six));
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   replace succeeds if the key is already present
     */
    public void testReplace2() {
        SnapTreeMap map = map5();
        assertNotNull(map.replace(one, "Z"));
        assertEquals("Z", map.get(one));
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * replace value fails when the given key not mapped to expected value
     */
    public void testReplaceValue() {
        SnapTreeMap map = map5();
        assertEquals("A", map.get(one));
        assertFalse(map.replace(one, "Z", "Z"));
        assertEquals("A", map.get(one));
    }
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.