1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
< |
import junit.framework.*; |
8 |
< |
import java.util.*; |
9 |
< |
import java.util.concurrent.*; |
10 |
< |
import java.io.*; |
7 |
> |
import java.util.ArrayList; |
8 |
> |
import java.util.Arrays; |
9 |
> |
import java.util.BitSet; |
10 |
> |
import java.util.Collection; |
11 |
> |
import java.util.Iterator; |
12 |
> |
import java.util.Map; |
13 |
> |
import java.util.NavigableMap; |
14 |
> |
import java.util.NavigableSet; |
15 |
> |
import java.util.NoSuchElementException; |
16 |
> |
import java.util.Random; |
17 |
> |
import java.util.Set; |
18 |
> |
import java.util.concurrent.ConcurrentSkipListMap; |
19 |
> |
|
20 |
> |
import junit.framework.Test; |
21 |
> |
import junit.framework.TestSuite; |
22 |
|
|
23 |
|
public class ConcurrentSkipListMapTest extends JSR166TestCase { |
24 |
|
public static void main(String[] args) { |
25 |
< |
junit.textui.TestRunner.run (suite()); |
25 |
> |
main(suite(), args); |
26 |
|
} |
27 |
|
public static Test suite() { |
28 |
|
return new TestSuite(ConcurrentSkipListMapTest.class); |
29 |
|
} |
30 |
|
|
31 |
|
/** |
32 |
< |
* Create a map from Integers 1-5 to Strings "A"-"E". |
32 |
> |
* Returns a new map from Integers 1-5 to Strings "A"-"E". |
33 |
|
*/ |
34 |
|
private static ConcurrentSkipListMap map5() { |
35 |
|
ConcurrentSkipListMap map = new ConcurrentSkipListMap(); |
45 |
|
} |
46 |
|
|
47 |
|
/** |
48 |
< |
* clear removes all pairs |
48 |
> |
* clear removes all pairs |
49 |
|
*/ |
50 |
|
public void testClear() { |
51 |
|
ConcurrentSkipListMap map = map5(); |
52 |
|
map.clear(); |
53 |
< |
assertEquals(map.size(), 0); |
53 |
> |
assertEquals(0, map.size()); |
54 |
|
} |
55 |
|
|
56 |
|
/** |
57 |
< |
* |
57 |
> |
* copy constructor creates map equal to source map |
58 |
|
*/ |
59 |
|
public void testConstructFromSorted() { |
60 |
|
ConcurrentSkipListMap map = map5(); |
63 |
|
} |
64 |
|
|
65 |
|
/** |
66 |
< |
* Maps with same contents are equal |
66 |
> |
* Maps with same contents are equal |
67 |
|
*/ |
68 |
|
public void testEquals() { |
69 |
|
ConcurrentSkipListMap map1 = map5(); |
76 |
|
} |
77 |
|
|
78 |
|
/** |
79 |
< |
* containsKey returns true for contained key |
79 |
> |
* containsKey returns true for contained key |
80 |
|
*/ |
81 |
|
public void testContainsKey() { |
82 |
|
ConcurrentSkipListMap map = map5(); |
85 |
|
} |
86 |
|
|
87 |
|
/** |
88 |
< |
* containsValue returns true for held values |
88 |
> |
* containsValue returns true for held values |
89 |
|
*/ |
90 |
|
public void testContainsValue() { |
91 |
|
ConcurrentSkipListMap map = map5(); |
94 |
|
} |
95 |
|
|
96 |
|
/** |
97 |
< |
* get returns the correct element at the given key, |
98 |
< |
* or null if not present |
97 |
> |
* get returns the correct element at the given key, |
98 |
> |
* or null if not present |
99 |
|
*/ |
100 |
|
public void testGet() { |
101 |
|
ConcurrentSkipListMap map = map5(); |
105 |
|
} |
106 |
|
|
107 |
|
/** |
108 |
< |
* isEmpty is true of empty map and false for non-empty |
108 |
> |
* isEmpty is true of empty map and false for non-empty |
109 |
|
*/ |
110 |
|
public void testIsEmpty() { |
111 |
|
ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); |
115 |
|
} |
116 |
|
|
117 |
|
/** |
118 |
< |
* firstKey returns first key |
118 |
> |
* firstKey returns first key |
119 |
|
*/ |
120 |
|
public void testFirstKey() { |
121 |
|
ConcurrentSkipListMap map = map5(); |
123 |
|
} |
124 |
|
|
125 |
|
/** |
126 |
< |
* lastKey returns last key |
126 |
> |
* lastKey returns last key |
127 |
|
*/ |
128 |
|
public void testLastKey() { |
129 |
|
ConcurrentSkipListMap map = map5(); |
130 |
|
assertEquals(five, map.lastKey()); |
131 |
|
} |
132 |
|
|
122 |
– |
|
133 |
|
/** |
134 |
< |
* keySet.toArray returns contains all keys |
134 |
> |
* keySet.toArray returns contains all keys |
135 |
|
*/ |
136 |
|
public void testKeySetToArray() { |
137 |
|
ConcurrentSkipListMap map = map5(); |
144 |
|
} |
145 |
|
|
146 |
|
/** |
147 |
< |
* descendingkeySet.toArray returns contains all keys |
147 |
> |
* descendingkeySet.toArray returns contains all keys |
148 |
|
*/ |
149 |
|
public void testDescendingKeySetToArray() { |
150 |
|
ConcurrentSkipListMap map = map5(); |
157 |
|
} |
158 |
|
|
159 |
|
/** |
160 |
< |
* keySet returns a Set containing all the keys |
160 |
> |
* keySet returns a Set containing all the keys |
161 |
|
*/ |
162 |
|
public void testKeySet() { |
163 |
|
ConcurrentSkipListMap map = map5(); |
171 |
|
} |
172 |
|
|
173 |
|
/** |
174 |
< |
* keySet is ordered |
174 |
> |
* keySet is ordered |
175 |
|
*/ |
176 |
|
public void testKeySetOrder() { |
177 |
|
ConcurrentSkipListMap map = map5(); |
186 |
|
last = k; |
187 |
|
++count; |
188 |
|
} |
189 |
< |
assertEquals(count ,5); |
189 |
> |
assertEquals(5, count); |
190 |
|
} |
191 |
|
|
192 |
|
/** |
205 |
|
last = k; |
206 |
|
++count; |
207 |
|
} |
208 |
< |
assertEquals(count ,5); |
208 |
> |
assertEquals(5, count); |
209 |
|
} |
210 |
|
|
211 |
|
/** |
212 |
< |
* descendingKeySet is ordered |
212 |
> |
* descendingKeySet is ordered |
213 |
|
*/ |
214 |
|
public void testDescendingKeySetOrder() { |
215 |
|
ConcurrentSkipListMap map = map5(); |
224 |
|
last = k; |
225 |
|
++count; |
226 |
|
} |
227 |
< |
assertEquals(count, 5); |
227 |
> |
assertEquals(5, count); |
228 |
|
} |
229 |
|
|
230 |
|
/** |
231 |
< |
* descending iterator of descendingKeySet is ordered |
231 |
> |
* descending iterator of descendingKeySet is ordered |
232 |
|
*/ |
233 |
|
public void testDescendingKeySetDescendingIteratorOrder() { |
234 |
|
ConcurrentSkipListMap map = map5(); |
243 |
|
last = k; |
244 |
|
++count; |
245 |
|
} |
246 |
< |
assertEquals(count, 5); |
246 |
> |
assertEquals(5, count); |
247 |
|
} |
248 |
|
|
249 |
|
/** |
250 |
< |
* Values.toArray contains all values |
250 |
> |
* Values.toArray contains all values |
251 |
|
*/ |
252 |
|
public void testValuesToArray() { |
253 |
|
ConcurrentSkipListMap map = map5(); |
315 |
|
} |
316 |
|
|
317 |
|
/** |
318 |
< |
* entrySet.toArray contains all entries |
318 |
> |
* entrySet.toArray contains all entries |
319 |
|
*/ |
320 |
|
public void testEntrySetToArray() { |
321 |
|
ConcurrentSkipListMap map = map5(); |
329 |
|
} |
330 |
|
|
331 |
|
/** |
332 |
< |
* descendingEntrySet.toArray contains all entries |
332 |
> |
* descendingEntrySet.toArray contains all entries |
333 |
|
*/ |
334 |
|
public void testDescendingEntrySetToArray() { |
335 |
|
ConcurrentSkipListMap map = map5(); |
343 |
|
} |
344 |
|
|
345 |
|
/** |
346 |
< |
* putAll adds all key-value pairs from the given map |
346 |
> |
* putAll adds all key-value pairs from the given map |
347 |
|
*/ |
348 |
|
public void testPutAll() { |
349 |
|
ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); |
358 |
|
} |
359 |
|
|
360 |
|
/** |
361 |
< |
* putIfAbsent works when the given key is not present |
361 |
> |
* putIfAbsent works when the given key is not present |
362 |
|
*/ |
363 |
|
public void testPutIfAbsent() { |
364 |
|
ConcurrentSkipListMap map = map5(); |
367 |
|
} |
368 |
|
|
369 |
|
/** |
370 |
< |
* putIfAbsent does not add the pair if the key is already present |
370 |
> |
* putIfAbsent does not add the pair if the key is already present |
371 |
|
*/ |
372 |
|
public void testPutIfAbsent2() { |
373 |
|
ConcurrentSkipListMap map = map5(); |
375 |
|
} |
376 |
|
|
377 |
|
/** |
378 |
< |
* replace fails when the given key is not present |
378 |
> |
* replace fails when the given key is not present |
379 |
|
*/ |
380 |
|
public void testReplace() { |
381 |
|
ConcurrentSkipListMap map = map5(); |
384 |
|
} |
385 |
|
|
386 |
|
/** |
387 |
< |
* replace succeeds if the key is already present |
387 |
> |
* replace succeeds if the key is already present |
388 |
|
*/ |
389 |
|
public void testReplace2() { |
390 |
|
ConcurrentSkipListMap map = map5(); |
392 |
|
assertEquals("Z", map.get(one)); |
393 |
|
} |
394 |
|
|
385 |
– |
|
395 |
|
/** |
396 |
|
* replace value fails when the given key not mapped to expected value |
397 |
|
*/ |
412 |
|
assertEquals("Z", map.get(one)); |
413 |
|
} |
414 |
|
|
406 |
– |
|
415 |
|
/** |
416 |
< |
* remove removes the correct key-value pair from the map |
416 |
> |
* remove removes the correct key-value pair from the map |
417 |
|
*/ |
418 |
|
public void testRemove() { |
419 |
|
ConcurrentSkipListMap map = map5(); |
435 |
|
map.remove(four, "A"); |
436 |
|
assertEquals(4, map.size()); |
437 |
|
assertTrue(map.containsKey(four)); |
430 |
– |
|
438 |
|
} |
439 |
|
|
440 |
|
/** |
453 |
|
|
454 |
|
Map.Entry e4 = map.lowerEntry(zero); |
455 |
|
assertNull(e4); |
449 |
– |
|
456 |
|
} |
457 |
|
|
458 |
|
/** |
471 |
|
|
472 |
|
Map.Entry e4 = map.higherEntry(six); |
473 |
|
assertNull(e4); |
468 |
– |
|
474 |
|
} |
475 |
|
|
476 |
|
/** |
489 |
|
|
490 |
|
Map.Entry e4 = map.floorEntry(zero); |
491 |
|
assertNull(e4); |
487 |
– |
|
492 |
|
} |
493 |
|
|
494 |
|
/** |
507 |
|
|
508 |
|
Map.Entry e4 = map.ceilingEntry(six); |
509 |
|
assertNull(e4); |
506 |
– |
|
510 |
|
} |
511 |
|
|
512 |
|
/** |
513 |
|
* lowerEntry, higherEntry, ceilingEntry, and floorEntry return |
514 |
< |
* imutable entries |
514 |
> |
* immutable entries |
515 |
|
*/ |
516 |
< |
public void testEntryImmutablity() { |
516 |
> |
public void testEntryImmutability() { |
517 |
|
ConcurrentSkipListMap map = map5(); |
518 |
|
Map.Entry e = map.lowerEntry(three); |
519 |
|
assertEquals(two, e.getKey()); |
541 |
|
} catch (UnsupportedOperationException success) {} |
542 |
|
} |
543 |
|
|
541 |
– |
|
542 |
– |
|
544 |
|
/** |
545 |
|
* lowerKey returns preceding element |
546 |
|
*/ |
557 |
|
|
558 |
|
Object e4 = q.lowerKey(zero); |
559 |
|
assertNull(e4); |
559 |
– |
|
560 |
|
} |
561 |
|
|
562 |
|
/** |
575 |
|
|
576 |
|
Object e4 = q.higherKey(six); |
577 |
|
assertNull(e4); |
578 |
– |
|
578 |
|
} |
579 |
|
|
580 |
|
/** |
593 |
|
|
594 |
|
Object e4 = q.floorKey(zero); |
595 |
|
assertNull(e4); |
597 |
– |
|
596 |
|
} |
597 |
|
|
598 |
|
/** |
611 |
|
|
612 |
|
Object e4 = q.ceilingKey(six); |
613 |
|
assertNull(e4); |
616 |
– |
|
614 |
|
} |
615 |
|
|
616 |
|
/** |
668 |
|
} |
669 |
|
|
670 |
|
/** |
671 |
< |
* size returns the correct values |
671 |
> |
* size returns the correct values |
672 |
|
*/ |
673 |
|
public void testSize() { |
674 |
|
ConcurrentSkipListMap map = map5(); |
684 |
|
ConcurrentSkipListMap map = map5(); |
685 |
|
String s = map.toString(); |
686 |
|
for (int i = 1; i <= 5; ++i) { |
687 |
< |
assertTrue(s.indexOf(String.valueOf(i)) >= 0); |
687 |
> |
assertTrue(s.contains(String.valueOf(i))); |
688 |
|
} |
689 |
|
} |
690 |
|
|
694 |
|
* get(null) of nonempty map throws NPE |
695 |
|
*/ |
696 |
|
public void testGet_NullPointerException() { |
697 |
+ |
ConcurrentSkipListMap c = map5(); |
698 |
|
try { |
701 |
– |
ConcurrentSkipListMap c = map5(); |
699 |
|
c.get(null); |
700 |
|
shouldThrow(); |
701 |
|
} catch (NullPointerException success) {} |
705 |
|
* containsKey(null) of nonempty map throws NPE |
706 |
|
*/ |
707 |
|
public void testContainsKey_NullPointerException() { |
708 |
+ |
ConcurrentSkipListMap c = map5(); |
709 |
|
try { |
712 |
– |
ConcurrentSkipListMap c = map5(); |
710 |
|
c.containsKey(null); |
711 |
|
shouldThrow(); |
712 |
|
} catch (NullPointerException success) {} |
716 |
|
* containsValue(null) throws NPE |
717 |
|
*/ |
718 |
|
public void testContainsValue_NullPointerException() { |
719 |
+ |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
720 |
|
try { |
723 |
– |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
721 |
|
c.containsValue(null); |
722 |
|
shouldThrow(); |
723 |
|
} catch (NullPointerException success) {} |
724 |
|
} |
725 |
|
|
729 |
– |
|
726 |
|
/** |
727 |
|
* put(null,x) throws NPE |
728 |
|
*/ |
729 |
|
public void testPut1_NullPointerException() { |
730 |
+ |
ConcurrentSkipListMap c = map5(); |
731 |
|
try { |
735 |
– |
ConcurrentSkipListMap c = map5(); |
732 |
|
c.put(null, "whatever"); |
733 |
|
shouldThrow(); |
734 |
|
} catch (NullPointerException success) {} |
738 |
|
* putIfAbsent(null, x) throws NPE |
739 |
|
*/ |
740 |
|
public void testPutIfAbsent1_NullPointerException() { |
741 |
+ |
ConcurrentSkipListMap c = map5(); |
742 |
|
try { |
746 |
– |
ConcurrentSkipListMap c = map5(); |
743 |
|
c.putIfAbsent(null, "whatever"); |
744 |
|
shouldThrow(); |
745 |
|
} catch (NullPointerException success) {} |
749 |
|
* replace(null, x) throws NPE |
750 |
|
*/ |
751 |
|
public void testReplace_NullPointerException() { |
752 |
+ |
ConcurrentSkipListMap c = map5(); |
753 |
|
try { |
757 |
– |
ConcurrentSkipListMap c = map5(); |
754 |
|
c.replace(null, "whatever"); |
755 |
|
shouldThrow(); |
756 |
|
} catch (NullPointerException success) {} |
760 |
|
* replace(null, x, y) throws NPE |
761 |
|
*/ |
762 |
|
public void testReplaceValue_NullPointerException() { |
763 |
+ |
ConcurrentSkipListMap c = map5(); |
764 |
|
try { |
768 |
– |
ConcurrentSkipListMap c = map5(); |
765 |
|
c.replace(null, one, "whatever"); |
766 |
|
shouldThrow(); |
767 |
|
} catch (NullPointerException success) {} |
771 |
|
* remove(null) throws NPE |
772 |
|
*/ |
773 |
|
public void testRemove1_NullPointerException() { |
774 |
+ |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
775 |
+ |
c.put("sadsdf", "asdads"); |
776 |
|
try { |
779 |
– |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
780 |
– |
c.put("sadsdf", "asdads"); |
777 |
|
c.remove(null); |
778 |
|
shouldThrow(); |
779 |
|
} catch (NullPointerException success) {} |
783 |
|
* remove(null, x) throws NPE |
784 |
|
*/ |
785 |
|
public void testRemove2_NullPointerException() { |
786 |
+ |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
787 |
+ |
c.put("sadsdf", "asdads"); |
788 |
|
try { |
791 |
– |
ConcurrentSkipListMap c = new ConcurrentSkipListMap(); |
792 |
– |
c.put("sadsdf", "asdads"); |
789 |
|
c.remove(null, "whatever"); |
790 |
|
shouldThrow(); |
791 |
|
} catch (NullPointerException success) {} |
801 |
|
} |
802 |
|
|
803 |
|
/** |
804 |
+ |
* A cloned map equals original |
805 |
+ |
*/ |
806 |
+ |
public void testClone() throws Exception { |
807 |
+ |
ConcurrentSkipListMap x = map5(); |
808 |
+ |
ConcurrentSkipListMap y = x.clone(); |
809 |
+ |
|
810 |
+ |
assertNotSame(x, y); |
811 |
+ |
assertEquals(x.size(), y.size()); |
812 |
+ |
assertEquals(x.toString(), y.toString()); |
813 |
+ |
assertEquals(x, y); |
814 |
+ |
assertEquals(y, x); |
815 |
+ |
y.clear(); |
816 |
+ |
assertTrue(y.isEmpty()); |
817 |
+ |
assertFalse(x.equals(y)); |
818 |
+ |
} |
819 |
+ |
|
820 |
+ |
/** |
821 |
|
* A deserialized map equals original |
822 |
|
*/ |
823 |
|
public void testSerialization() throws Exception { |
824 |
< |
ConcurrentSkipListMap q = map5(); |
824 |
> |
NavigableMap x = map5(); |
825 |
> |
NavigableMap y = serialClone(x); |
826 |
|
|
827 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
828 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
829 |
< |
out.writeObject(q); |
830 |
< |
out.close(); |
831 |
< |
|
832 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
833 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
834 |
< |
ConcurrentSkipListMap r = (ConcurrentSkipListMap)in.readObject(); |
821 |
< |
assertEquals(q.size(), r.size()); |
822 |
< |
assertTrue(q.equals(r)); |
823 |
< |
assertTrue(r.equals(q)); |
827 |
> |
assertNotSame(x, y); |
828 |
> |
assertEquals(x.size(), y.size()); |
829 |
> |
assertEquals(x.toString(), y.toString()); |
830 |
> |
assertEquals(x, y); |
831 |
> |
assertEquals(y, x); |
832 |
> |
y.clear(); |
833 |
> |
assertTrue(y.isEmpty()); |
834 |
> |
assertFalse(x.equals(y)); |
835 |
|
} |
836 |
|
|
826 |
– |
|
827 |
– |
|
837 |
|
/** |
838 |
|
* subMap returns map with keys in requested range |
839 |
|
*/ |
870 |
|
assertEquals(1, sm.size()); |
871 |
|
assertEquals(three, sm.firstKey()); |
872 |
|
assertEquals(three, sm.lastKey()); |
873 |
< |
assertTrue(sm.remove(three) != null); |
873 |
> |
assertEquals("C", sm.remove(three)); |
874 |
|
assertTrue(sm.isEmpty()); |
875 |
|
assertEquals(3, map.size()); |
876 |
|
} |
903 |
|
assertEquals(4, map.size()); |
904 |
|
assertEquals(0, sm.size()); |
905 |
|
assertTrue(sm.isEmpty()); |
906 |
< |
assertTrue(sm.remove(three) == null); |
906 |
> |
assertSame(sm.remove(three), null); |
907 |
|
assertEquals(4, map.size()); |
908 |
|
} |
909 |
|
|
985 |
|
NavigableMap ssm = sm.tailMap(four, true); |
986 |
|
assertEquals(four, ssm.firstKey()); |
987 |
|
assertEquals(five, ssm.lastKey()); |
988 |
< |
assertTrue(ssm.remove(four) != null); |
988 |
> |
assertEquals("D", ssm.remove(four)); |
989 |
|
assertEquals(1, ssm.size()); |
990 |
|
assertEquals(3, sm.size()); |
991 |
|
assertEquals(4, map.size()); |
998 |
|
* Submaps of submaps subdivide correctly |
999 |
|
*/ |
1000 |
|
public void testRecursiveSubMaps() throws Exception { |
1001 |
< |
int mapSize = 1000; |
1001 |
> |
int mapSize = expensiveTests ? 1000 : 100; |
1002 |
|
Class cl = ConcurrentSkipListMap.class; |
1003 |
|
NavigableMap<Integer, Integer> map = newMap(cl); |
1004 |
|
bs = new BitSet(mapSize); |
1017 |
|
|
1018 |
|
static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception { |
1019 |
|
NavigableMap<Integer, Integer> result = |
1020 |
< |
(NavigableMap<Integer, Integer>) cl.newInstance(); |
1021 |
< |
assertEquals(result.size(), 0); |
1020 |
> |
(NavigableMap<Integer, Integer>) cl.getConstructor().newInstance(); |
1021 |
> |
assertEquals(0, result.size()); |
1022 |
|
assertFalse(result.keySet().iterator().hasNext()); |
1023 |
|
return result; |
1024 |
|
} |
1050 |
|
// Add entries till we're back to original size |
1051 |
|
while (map.size() < size) { |
1052 |
|
int key = min + rnd.nextInt(rangeSize); |
1053 |
< |
assertTrue(key >= min && key<= max); |
1053 |
> |
assertTrue(key >= min && key <= max); |
1054 |
|
put(map, key); |
1055 |
|
} |
1056 |
|
} |
1075 |
|
// Add entries till we're back to original size |
1076 |
|
while (map.size() < size) { |
1077 |
|
int key = min - 5 + rnd.nextInt(rangeSize + 10); |
1078 |
< |
if (key >= min && key<= max) { |
1078 |
> |
if (key >= min && key <= max) { |
1079 |
|
put(map, key); |
1080 |
|
} else { |
1081 |
|
try { |
1179 |
|
*/ |
1180 |
|
void check(NavigableMap<Integer, Integer> map, |
1181 |
|
final int min, final int max, final boolean ascending) { |
1182 |
< |
class ReferenceSet { |
1182 |
> |
class ReferenceSet { |
1183 |
|
int lower(int key) { |
1184 |
|
return ascending ? lowerAscending(key) : higherAscending(key); |
1185 |
|
} |
1210 |
|
// BitSet should support this! Test would run much faster |
1211 |
|
while (key >= min) { |
1212 |
|
if (bs.get(key)) |
1213 |
< |
return(key); |
1213 |
> |
return key; |
1214 |
|
key--; |
1215 |
|
} |
1216 |
|
return -1; |
1245 |
|
if (bsContainsI) |
1246 |
|
size++; |
1247 |
|
} |
1248 |
< |
assertEquals(map.size(), size); |
1248 |
> |
assertEquals(size, map.size()); |
1249 |
|
|
1250 |
|
// Test contents using contains keySet iterator |
1251 |
|
int size2 = 0; |
1293 |
|
} |
1294 |
|
|
1295 |
|
static boolean eq(Integer i, int j) { |
1296 |
< |
return i == null ? j == -1 : i == j; |
1296 |
> |
return (i == null) ? j == -1 : i == j; |
1297 |
|
} |
1298 |
|
|
1299 |
|
} |