コード例 #1
0
 /** headMap returns map with keys in requested range */
 public void testDescendingHeadMapContents() {
   ConcurrentNavigableMap map = dmap5();
   SortedMap sm = map.headMap(m4);
   assertTrue(sm.containsKey(m1));
   assertTrue(sm.containsKey(m2));
   assertTrue(sm.containsKey(m3));
   assertFalse(sm.containsKey(m4));
   assertFalse(sm.containsKey(m5));
   Iterator i = sm.keySet().iterator();
   Object k;
   k = (Integer) (i.next());
   assertEquals(m1, k);
   k = (Integer) (i.next());
   assertEquals(m2, k);
   k = (Integer) (i.next());
   assertEquals(m3, k);
   assertFalse(i.hasNext());
   sm.clear();
   assertTrue(sm.isEmpty());
   assertEquals(2, map.size());
   assertEquals(m4, map.firstKey());
 }
コード例 #2
0
 /** headMap returns map with keys in requested range */
 public void testHeadMapContents() {
   ConcurrentNavigableMap map = map5();
   SortedMap sm = map.headMap(four);
   assertTrue(sm.containsKey(one));
   assertTrue(sm.containsKey(two));
   assertTrue(sm.containsKey(three));
   assertFalse(sm.containsKey(four));
   assertFalse(sm.containsKey(five));
   Iterator i = sm.keySet().iterator();
   Object k;
   k = (Integer) (i.next());
   assertEquals(one, k);
   k = (Integer) (i.next());
   assertEquals(two, k);
   k = (Integer) (i.next());
   assertEquals(three, k);
   assertFalse(i.hasNext());
   sm.clear();
   assertTrue(sm.isEmpty());
   assertEquals(2, map.size());
   assertEquals(four, map.firstKey());
 }
コード例 #3
0
 /** firstKey returns first key */
 public void testDescendingFirstKey() {
   ConcurrentNavigableMap map = dmap5();
   assertEquals(m1, map.firstKey());
 }
コード例 #4
0
 /** firstKey returns first key */
 public void testFirstKey() {
   ConcurrentNavigableMap map = map5();
   assertEquals(one, map.firstKey());
 }