Package java.util

Examples of java.util.TreeMap.firstKey()


                }
            }
        }

        return matches.size() == 0
               ? null : (String) matches.get( matches.firstKey() );
    }

    /**
     * Grab lists of all root-level files and all directories
     * contained in the given archive.
View Full Code Here


    sorter.put(getDistance(aSegment, northWest), northWest);
    sorter.put(getDistance(aSegment, southWest), southWest);
    sorter.put(getDistance(aSegment, southEast), southEast);
    sorter.put(getDistance(aSegment, northEast), northEast);

    return ((OrientedPoint) sorter.get(sorter.firstKey())).getOrientation();

  }

  private static Double getDistance(Line2D aSegment, Point aPoint) {
    double lenght1 = getLineLength(aSegment.getX1(), aSegment.getY1(), aPoint.getX(), aPoint.getY());
View Full Code Here

                }
            }
        }

        return matches.size() == 0
            ? null : (String) matches.get(matches.firstKey());
    }

    /**
     * Grab lists of all root-level files and all directories
     * contained in the given archive.
View Full Code Here

        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()));
        assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
                reversedTreeMap.lastKey().equals(new Integer(1).toString()));

    }
View Full Code Here

        reversedTreeMap.put(new Integer(2).toString(), new Integer(2));
        TreeMap anotherTreeMap = new TreeMap(reversedTreeMap);
        assertTrue("New tree map does not answer correct comparator",
                anotherTreeMap.comparator() == comp);
        assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
                anotherTreeMap.firstKey().equals(new Integer(2).toString()));
        assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
                anotherTreeMap.lastKey().equals(new Integer(1).toString()));

    }
View Full Code Here

        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()));
        assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
                reversedTreeMap.lastKey().equals(new Integer(1).toString()));
    }

    /**
 
View Full Code Here

    }

    public void test_TreeMap_Constructor_Map() {
        TreeMap treeMap = new TreeMap(tm);
        assertEquals(tm.size(), treeMap.size());
        assertEquals(tm.firstKey(), treeMap.firstKey());
        assertEquals(tm.firstEntry(), treeMap.firstEntry());
        assertEquals(tm.lastKey(), treeMap.lastKey());
        assertEquals(tm.lastEntry(), treeMap.lastEntry());
        assertEquals(tm.keySet(), treeMap.keySet());
View Full Code Here

    }

    public void test_TreeMap_Constructor_SortedMap() {
        TreeMap treeMap = new TreeMap(subMap_default);
        assertEquals(subMap_default.size(), treeMap.size());
        assertEquals(subMap_default.firstKey(), treeMap.firstKey());
        assertEquals(subMap_default.lastKey(), treeMap.lastKey());
        assertEquals(subMap_default.keySet(), treeMap.keySet());
        assertEquals(subMap_default.entrySet(), treeMap.entrySet());
    }
View Full Code Here

        assertTrue(treeMap.isEmpty());
        assertNull(treeMap.comparator());
        assertEquals(0, treeMap.size());

        try {
            treeMap.firstKey();
            fail("should throw NoSuchElementException");
        } catch (NoSuchElementException e) {
            // Expected
        }
        assertNull(treeMap.firstEntry());
View Full Code Here

    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

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.