Examples of subMap()


Examples of java.util.SortedMap.subMap()

      sortedMap.subMap(getConflictingKey(), keys[0]);
      fail("ClassCastException expected");
    } catch (ClassCastException expected) {
    }
    try {
      sortedMap.subMap(keys[0], getConflictingKey());
      fail("ClassCastException expected");
    } catch (ClassCastException expected) {
    }
  }
View Full Code Here

Examples of java.util.SortedMap.subMap()

        map.put("C", "c");
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B", map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B", map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B", map.subMap("A", "C").lastKey(), "B");

        Comparator c = map.comparator();
        assertTrue("natural order, so comparator should be null", c == null);
    }
View Full Code Here

Examples of java.util.SortedMap.subMap()

        assertFalse(s.containsKey(null));
        // RI fails here
        // assertTrue(s.containsKey("1st"));
        // assertTrue(s.containsKey("2nd"));
        s = tm.descendingMap();
        s = s.subMap("3rd", null);
        // assertEquals(4, s.size());
//        assertTrue(s.containsValue(-1));
//        assertTrue(s.containsValue(1));
//        assertTrue(s.containsValue(2));
//        assertTrue(s.containsValue(3));
View Full Code Here

Examples of java.util.SortedMap.subMap()

        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
           map.subMap("A","C").lastKey(), "B");
       
        Comparator c = map.comparator();
        assertTrue("natural order, so comparator should be null",
            c == null);     
    }
View Full Code Here

Examples of java.util.TreeMap.subMap()

        master.put("null", null);
        Object[] entry = master.entrySet().toArray();
        assertFalse("Empty map should not contain the null-valued entry",
                    test_map.entrySet().contains(entry[0]));

        Map<String, String> submap = test_map.subMap("a","z");
        entry = master.entrySet().toArray();
        assertFalse("Empty submap should not contain the null-valued entry",
                    submap.entrySet().contains(entry[0]));

        test_map.put("null", null);
View Full Code Here

Examples of java.util.TreeMap.subMap()

        master.put("null", null);
        Object[] entry = master.entrySet().toArray();
        assertFalse("Empty map should not contain the null-valued entry",
                    test_map.entrySet().contains(entry[0]));

        Map<String, String> submap = test_map.subMap("a","z");
        entry = master.entrySet().toArray();
        assertFalse("Empty submap should not contain the null-valued entry",
                    submap.entrySet().contains(entry[0]));

        test_map.put("null", null);
View Full Code Here

Examples of java.util.TreeMap.subMap()

        TreeMap tm_null = new TreeMap();
        tm_null.put("0", 1);
        tm_null.put("1", null);
        tm_null.put("2", 2);
        SortedMap subMap = tm_null.subMap("0", "2");
        assertTrue(subMap.containsValue(null));

        subMap.remove("1");
        assertFalse(subMap.containsValue(null));
    }
View Full Code Here

Examples of java.util.TreeMap.subMap()

    }

    public void test_AscendingSubMapKeySet_remove() {
        TreeMap tm_rm = new TreeMap(tm);
        SortedMap subMap_startExcluded_endExcluded_rm = tm_rm.subMap(
                objArray[100].toString(), false, objArray[109].toString(),
                false);
        assertNull(subMap_startExcluded_endExcluded_rm.remove("0"));
        try {
            subMap_startExcluded_endExcluded_rm.remove(null);
View Full Code Here

Examples of java.util.TreeMap.subMap()

    public void test_headMap() throws Exception {
        TreeMap tree = new TreeMap();
        tree.put(new Integer(0), null);
        tree.put(new Integer(1), null);
        Map submap = tree.subMap(tree.firstKey(), tree.lastKey());
        tree.remove(tree.lastKey());
        assertEquals(submap, tree);
    }

    public void testname() throws Exception {
View Full Code Here

Examples of java.util.TreeMap.subMap()

        nullTree.put(new String("One"), 1);
        nullTree.put(new String("Two"), 2);
        nullTree.put(new String("Three"), 3);
        nullTree.put(new String("Four"), 4);
        nullTree.put(null, 0);
        nullTree.subMap(null, "two").size();
    }

}
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.