Examples of comparator()


Examples of java.util.SortedMap.comparator()

        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);     
    }
   
    public void testTransformerDecorate() {
View Full Code Here

Examples of java.util.SortedMap.comparator()

        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.comparator()

                if (comparator != null && comparatorField != null) {
                    comparatorField.set(result, comparator);
                }
                result.putAll(sortedMap); // internal optimization will not call comparator
            } else if (comparatorField != null) {
                comparatorField.set(result, sortedMap.comparator());
                result.putAll(sortedMap); // "sort" by index
                comparatorField.set(result, comparator);
            } else {
                result.putAll(sortedMap); // will use comparator for already sorted map
            }
View Full Code Here

Examples of java.util.SortedSet.comparator()

         !set.contains("Afour"));  
    }
   
    public void testComparator() {
        SortedSet set = makeTestSet();
        Comparator c = set.comparator();
        assertTrue("natural order, so comparator should be null", c == null);
    }

    public String getCompatibilityVersion() {
        return "3.1";
View Full Code Here

Examples of java.util.SortedSet.comparator()

         !set.contains("Afour"));  
    }
   
    public void testComparator() {
        SortedSet set = makeTestSet();
        Comparator c = set.comparator();
        assertTrue("natural order, so comparator should be null", c == null);
    }

    public String getCompatibilityVersion() {
        return "3.1";
View Full Code Here

Examples of java.util.SortedSet.comparator()

         !set.contains("Afour"));  
    }
   
    public void testComparator() {
        SortedSet set = makeTestSet();
        Comparator c = set.comparator();
        assertTrue("natural order, so comparator should be null", c == null);
    }
       
}
View Full Code Here

Examples of java.util.TreeMap.comparator()

        populate(orig);
        assertMapsEqual(new HashMap(orig), (Map) _mgr.copyMap(orig));

        TreeMap torig = (TreeMap) _mgr.newMapProxy(TreeMap.class, null, null,
            new CustomComparator());
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedMapsEqual(new TreeMap(torig), (SortedMap)
            _mgr.copyMap(torig));
    }
View Full Code Here

Examples of java.util.TreeMap.comparator()

        Map orig = (Map) _mgr.newMapProxy(HashMap.class, null, null, null, true);
        populate(orig);
        assertMapsEqual(new HashMap(orig), (Map) _mgr.copyMap(orig));

        TreeMap torig = (TreeMap) _mgr.newMapProxy(TreeMap.class, null, null, new CustomComparator(), true);
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedMapsEqual(new TreeMap(torig), (SortedMap) _mgr.copyMap(torig));
    }

    public void testCloneProxyMap() {
View Full Code Here

Examples of java.util.TreeMap.comparator()

    public void testCloneProxyMap() {
        // Map does not support clone()

        TreeMap torig = (TreeMap) _mgr.newMapProxy(TreeMap.class, null, null, new CustomComparator(), true);
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedMapsEquals(new TreeMap(torig), (SortedMap) torig.clone());
    }

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

Examples of java.util.TreeMap.comparator()

     */
    public void test_ConstructorLjava_util_Comparator() {
        // Test for method java.util.TreeMap(java.util.Comparator)
        Comparator comp = new ReversedComparator();
        TreeMap reversedTreeMap = new TreeMap(comp);
        assertTrue("TreeMap answered incorrect comparator", reversedTreeMap
                .comparator() == comp);
        reversedTreeMap.put(new Integer(1).toString(), new Integer(1));
        reversedTreeMap.put(new Integer(2).toString(), new Integer(2));
        assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
                reversedTreeMap.firstKey().equals(new Integer(2).toString()));
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.