Examples of subMap()


Examples of java.util.TreeMap.subMap()

        SortedMap<String, String> sub = map.subMap("1", "3"); //$NON-NLS-1$ //$NON-NLS-2$
        assertEquals("2", sub.lastKey()); //$NON-NLS-1$
       
        TreeMap t = new TreeMap();
        try {
      SortedMap th = t.subMap(null,new Object());
      fail("Should throw a NullPointerException");
        } catch( NullPointerException npe) {
          // expected
        }
    }
View Full Code Here

Examples of java.util.TreeMap.subMap()

        TreeMap myTreeMap = new TreeMap();
        for (int i = 0; i < 1000; i++) {
            myTreeMap.put(i, objArray[i]);
        }
        // Test for method values() in subMaps
        Collection vals = myTreeMap.subMap(200, 400).values();
        assertTrue("Returned collection of incorrect size", vals.size() == 200);
        for (int i = 200; i < 400; i++) {
            assertTrue("Collection contains incorrect elements" + i, vals
                    .contains(objArray[i]));
        }
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.concurrent.ConcurrentNavigableMap.subMap()

    /**
     * subMap returns map with keys in requested range
     */
    public void testSubMapContents() {
        ConcurrentNavigableMap map = map5();
        SortedMap sm = map.subMap(two, four);
        assertEquals(two, sm.firstKey());
        assertEquals(three, sm.lastKey());
        assertEquals(2, sm.size());
        assertFalse(sm.containsKey(one));
        assertTrue(sm.containsKey(two));
View Full Code Here

Examples of java.util.concurrent.ConcurrentNavigableMap.subMap()

        assertEquals(3, map.size());
    }

    public void testSubMapContents2() {
        ConcurrentNavigableMap map = map5();
        SortedMap sm = map.subMap(two, three);
        assertEquals(1, sm.size());
        assertEquals(two, sm.firstKey());
        assertEquals(two, sm.lastKey());
        assertFalse(sm.containsKey(one));
        assertTrue(sm.containsKey(two));
View Full Code Here

Examples of org.apache.commons.collections.SortedBidiMap.subMap()

        Object firstValue = sm.get(first);
        Object fromKeyValue = sm.get(fromKey);
        Object secondValue = sm.get(second);
        Object thirdValue = sm.get(third);
       
        SortedMap sub = sm.subMap(fromKey, toKey);
        assertEquals(2, sub.size());
        assertEquals(true, sm.containsKey(first));
        assertEquals(false, sub.containsKey(first));
        assertEquals(true, sm.containsValue(firstValue));
        assertEquals(false, sub.containsValue(firstValue));
View Full Code Here

Examples of org.apache.commons.collections.SortedBidiMap.subMap()

        Object fromKeyValue = sm.get(fromKey);
        Object firstValue = sm.get(first);
        Object secondValue = sm.get(second);
        Object toKeyValue = sm.get(toKey);
       
        SortedMap sub = sm.subMap(fromKey, toKey);
        int size = sm.size();
        assertEquals(3, sub.size());
        sub.clear();
        assertEquals(0, sub.size());
        assertEquals(size - 3, sm.size());
View Full Code Here

Examples of org.apache.commons.collections.SortedBidiMap.subMap()

        Object first = it.next();
        Object second = it.next();
        Object toKey = it.next();
       
        int size = sm.size();
        SortedMap sub = sm.subMap(fromKey, toKey);
        assertEquals(true, sm.containsKey(first));
        assertEquals(true, sub.containsKey(first));
        assertEquals(true, sm.containsKey(second));
        assertEquals(true, sub.containsKey(second));
       
View Full Code Here

Examples of org.apache.commons.collections.SortedBidiMap.subMap()

        Object first = it.next();
        Object second = it.next();
        Object toKey = it.next();
       
        int size = sm.size();
        SortedMap sub = sm.subMap(fromKey, toKey);
        Set set = sub.entrySet();
        assertEquals(3, set.size());
        Iterator it2 = set.iterator();
        Object fromEntry = it2.next();
        Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
View Full Code Here

Examples of org.apache.commons.collections.SortedBidiMap.subMap()

        Object firstValue = sm.get(first);
        Object fromKeyValue = sm.get(fromKey);
        Object secondValue = sm.get(second);
        Object thirdValue = sm.get(third);
       
        SortedMap sub = sm.subMap(fromKey, toKey);
        assertEquals(2, sub.size());
        assertEquals(true, sm.containsKey(first));
        assertEquals(false, sub.containsKey(first));
        assertEquals(true, sm.containsValue(firstValue));
        assertEquals(false, sub.containsValue(firstValue));
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.