592 |
|
*/ |
593 |
|
public void testSubMapContents() { |
594 |
|
TreeMap map = map5(); |
595 |
< |
NavigableMap sm = map.navigableSubMap(two, true, four, false); |
595 |
> |
NavigableMap sm = map.subMap(two, true, four, false); |
596 |
|
assertEquals(two, sm.firstKey()); |
597 |
|
assertEquals(three, sm.lastKey()); |
598 |
|
assertEquals(2, sm.size()); |
630 |
|
|
631 |
|
public void testSubMapContents2() { |
632 |
|
TreeMap map = map5(); |
633 |
< |
NavigableMap sm = map.navigableSubMap(two, true, three, false); |
633 |
> |
NavigableMap sm = map.subMap(two, true, three, false); |
634 |
|
assertEquals(1, sm.size()); |
635 |
|
assertEquals(two, sm.firstKey()); |
636 |
|
assertEquals(two, sm.lastKey()); |
665 |
|
*/ |
666 |
|
public void testHeadMapContents() { |
667 |
|
TreeMap map = map5(); |
668 |
< |
NavigableMap sm = map.navigableHeadMap(four, false); |
668 |
> |
NavigableMap sm = map.headMap(four, false); |
669 |
|
assertTrue(sm.containsKey(one)); |
670 |
|
assertTrue(sm.containsKey(two)); |
671 |
|
assertTrue(sm.containsKey(three)); |
691 |
|
*/ |
692 |
|
public void testTailMapContents() { |
693 |
|
TreeMap map = map5(); |
694 |
< |
NavigableMap sm = map.navigableTailMap(two, true); |
694 |
> |
NavigableMap sm = map.tailMap(two, true); |
695 |
|
assertFalse(sm.containsKey(one)); |
696 |
|
assertTrue(sm.containsKey(two)); |
697 |
|
assertTrue(sm.containsKey(three)); |
735 |
|
assertEquals("E", e.getValue()); |
736 |
|
assertFalse(i.hasNext()); |
737 |
|
|
738 |
< |
NavigableMap ssm = sm.navigableTailMap(four, true); |
738 |
> |
NavigableMap ssm = sm.tailMap(four, true); |
739 |
|
assertEquals(four, ssm.firstKey()); |
740 |
|
assertEquals(five, ssm.lastKey()); |
741 |
|
assertTrue(ssm.remove(four) != null); |
764 |
|
check(map, 0, mapSize - 1, true); |
765 |
|
check(map.descendingMap(), 0, mapSize - 1, false); |
766 |
|
|
767 |
< |
bashSubMap(map.navigableSubMap(0, true, mapSize, false), |
767 |
> |
bashSubMap(map.subMap(0, true, mapSize, false), |
768 |
|
0, mapSize - 1, true); |
769 |
|
} |
770 |
|
|
871 |
|
|
872 |
|
// headMap - pick direction and endpoint inclusion randomly |
873 |
|
boolean incl = rnd.nextBoolean(); |
874 |
< |
NavigableMap<Integer,Integer> hm = map.navigableHeadMap(midPoint, incl); |
874 |
> |
NavigableMap<Integer,Integer> hm = map.headMap(midPoint, incl); |
875 |
|
if (ascending) { |
876 |
|
if (rnd.nextBoolean()) |
877 |
|
bashSubMap(hm, min, midPoint - (incl ? 0 : 1), true); |
888 |
|
|
889 |
|
// tailMap - pick direction and endpoint inclusion randomly |
890 |
|
incl = rnd.nextBoolean(); |
891 |
< |
NavigableMap<Integer,Integer> tm = map.navigableTailMap(midPoint,incl); |
891 |
> |
NavigableMap<Integer,Integer> tm = map.tailMap(midPoint,incl); |
892 |
|
if (ascending) { |
893 |
|
if (rnd.nextBoolean()) |
894 |
|
bashSubMap(tm, midPoint + (incl ? 0 : 1), max, true); |
913 |
|
boolean lowIncl = rnd.nextBoolean(); |
914 |
|
boolean highIncl = rnd.nextBoolean(); |
915 |
|
if (ascending) { |
916 |
< |
NavigableMap<Integer,Integer> sm = map.navigableSubMap( |
916 |
> |
NavigableMap<Integer,Integer> sm = map.subMap( |
917 |
|
endpoints[0], lowIncl, endpoints[1], highIncl); |
918 |
|
if (rnd.nextBoolean()) |
919 |
|
bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), |
922 |
|
bashSubMap(sm.descendingMap(), endpoints[0] + (lowIncl ? 0 : 1), |
923 |
|
endpoints[1] - (highIncl ? 0 : 1), false); |
924 |
|
} else { |
925 |
< |
NavigableMap<Integer,Integer> sm = map.navigableSubMap( |
925 |
> |
NavigableMap<Integer,Integer> sm = map.subMap( |
926 |
|
endpoints[1], highIncl, endpoints[0], lowIncl); |
927 |
|
if (rnd.nextBoolean()) |
928 |
|
bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), |