Package java.util

Examples of java.util.SortedMap.firstKey()


             if (logger.isLoggable(Level.FINER)) {            
                 logger.finer(" Instance "+ server +" started at :"+ startTime);
             }
             map.put(startTime, server);
         }
         return (String) map.get(map.firstKey());
    }       
}
View Full Code Here


         assertEquals(((SortedMap)server.getAttribute(name, "Entries")).size(), 3);
         Date start2 = (Date)server.getAttribute(name, "RecordingStart");

         assertTrue(start1.equals(start2) || start1.before(start2));
         SortedMap values = (SortedMap)server.getAttribute(name, "Entries");
         PointTime point1 = (PointTime)values.firstKey();
         PointTime point2 = (PointTime)values.lastKey();
         assertTrue(point1.getDate().equals(point2.getDate()) || point1.getDate().before(point2.getDate()));

         // re start it
         server.invoke(name, "stop", null, null);
View Full Code Here

    public void testSortOrder() {
        SortedMap map = makeTestSortedMap(oneFactory);
        map.put("A", "a");
        map.get("B"); // Entry with value "One" created
        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");
View Full Code Here

            SortedMap smallerSizes = charSets.headMap(requestedSize);
            SortedMap largerSizes = charSets.tailMap(requestedSize);
            int smallerSize = smallerSizes.isEmpty() ? 0
                    : ((Integer)smallerSizes.lastKey()).intValue();
            int largerSize = largerSizes.isEmpty() ? Integer.MAX_VALUE
                    : ((Integer)largerSizes.firstKey()).intValue();

            Integer fontSize;
            if (!smallerSizes.isEmpty()
                            && (size - smallerSize) <= (largerSize - size)) {
                fontSize = new Integer(smallerSize);
View Full Code Here

    public void testSortOrder() {
        SortedMap map = makeTestSortedMap(oneFactory);
        map.put("A""a");
        map.get("B"); // Entry with value "One" created
        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");
View Full Code Here

        // no tests I can think of
    }
   
    public void testFirstKey() {
        SortedMap sm = (SortedMap) makeFullMap();
        assertSame(sm.keySet().iterator().next(), sm.firstKey());
    }
   
    public void testLastKey() {
        SortedMap sm = (SortedMap) makeFullMap();
        Object obj = null;
View Full Code Here

            map.put("D", null);
            fail("Null value should raise IllegalArgument");
        } catch (IllegalArgumentException e) {
            // expected
        }
        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");
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.