author | jdv |
Wed, 15 May 2019 10:10:53 +0530 | |
branch | metal-prototype-branch |
changeset 57357 | f3beca8f19fc |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
1 |
/* |
28667
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
4 |
* |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
8 |
* |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
13 |
* accompanied this code). |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
14 |
* |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
18 |
* |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
21 |
* questions. |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
22 |
*/ |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
23 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
24 |
/** |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
25 |
* @test |
28667
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
26 |
* @bug 8020156 8020009 8022326 8012913 8024405 8024408 8071477 |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
27 |
* @run testng SpliteratorCharacteristics |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
28 |
*/ |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
29 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
30 |
import org.testng.annotations.Test; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
31 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
32 |
import java.util.Arrays; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
33 |
import java.util.Collection; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
34 |
import java.util.Comparator; |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
35 |
import java.util.HashMap; |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
36 |
import java.util.HashSet; |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
37 |
import java.util.LinkedHashMap; |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
38 |
import java.util.LinkedHashSet; |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
39 |
import java.util.List; |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
40 |
import java.util.Map; |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
41 |
import java.util.PrimitiveIterator; |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
42 |
import java.util.Set; |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
43 |
import java.util.SortedMap; |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
44 |
import java.util.SortedSet; |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
45 |
import java.util.Spliterator; |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
46 |
import java.util.Spliterators; |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
47 |
import java.util.TreeMap; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
48 |
import java.util.TreeSet; |
20489
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
49 |
import java.util.WeakHashMap; |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
50 |
import java.util.concurrent.ConcurrentSkipListMap; |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
51 |
import java.util.concurrent.ConcurrentSkipListSet; |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
52 |
import java.util.function.Supplier; |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
53 |
import java.util.stream.DoubleStream; |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
54 |
import java.util.stream.IntStream; |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
55 |
import java.util.stream.LongStream; |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
56 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
57 |
import static org.testng.Assert.*; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
58 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
59 |
@Test |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
60 |
public class SpliteratorCharacteristics { |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
61 |
|
28667
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
62 |
public void testSpliteratorFromCharSequence() { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
63 |
class CharSequenceImpl implements CharSequence { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
64 |
final String s; |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
65 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
66 |
public CharSequenceImpl(String s) { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
67 |
this.s = s; |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
68 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
69 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
70 |
@Override |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
71 |
public int length() { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
72 |
return s.length(); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
73 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
74 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
75 |
@Override |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
76 |
public char charAt(int index) { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
77 |
return s.charAt(index); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
78 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
79 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
80 |
@Override |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
81 |
public CharSequence subSequence(int start, int end) { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
82 |
return s.subSequence(start, end); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
83 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
84 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
85 |
@Override |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
86 |
public String toString() { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
87 |
return s; |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
88 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
89 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
90 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
91 |
CharSequence cs = "A"; |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
92 |
Spliterator.OfInt s = cs.chars().spliterator(); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
93 |
assertCharacteristics(s, Spliterator.IMMUTABLE | Spliterator.ORDERED | |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
94 |
Spliterator.SIZED | Spliterator.SUBSIZED); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
95 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
96 |
s = cs.codePoints().spliterator(); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
97 |
assertCharacteristics(s, Spliterator.IMMUTABLE | Spliterator.ORDERED); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
98 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
99 |
|
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
100 |
for (CharSequence c : Arrays.asList(new CharSequenceImpl("A"), |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
101 |
new StringBuilder("A"), |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
102 |
new StringBuffer("A"))) { |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
103 |
s = cs.chars().spliterator(); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
104 |
assertCharacteristics(s, Spliterator.ORDERED | |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
105 |
Spliterator.SIZED | Spliterator.SUBSIZED); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
106 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
107 |
s = cs.codePoints().spliterator(); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
108 |
assertCharacteristics(s, Spliterator.ORDERED); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
109 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
110 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
111 |
} |
2245cc40bf5d
8071477: Better Spliterator implementations for String.chars() and String.codePoints()
psandoz
parents:
20489
diff
changeset
|
112 |
|
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
113 |
public void testSpliteratorFromCollection() { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
114 |
List<Integer> l = Arrays.asList(1, 2, 3, 4); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
115 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
116 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
117 |
Spliterator<?> s = Spliterators.spliterator(l, 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
118 |
assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
119 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
120 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
121 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
122 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
123 |
Spliterator<?> s = Spliterators.spliterator(l, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
124 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
125 |
assertCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
126 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
127 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
128 |
{ |
32991
b27c76b82713
8134853: Bulk integration of java.util.concurrent classes
dl
parents:
28667
diff
changeset
|
129 |
Spliterator<?> s = Spliterators.spliterator(l.iterator(), 1, 0); |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
130 |
assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
131 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
132 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
133 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
134 |
{ |
32991
b27c76b82713
8134853: Bulk integration of java.util.concurrent classes
dl
parents:
28667
diff
changeset
|
135 |
Spliterator<?> s = Spliterators.spliterator(l.iterator(), 1, Spliterator.CONCURRENT); |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
136 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
137 |
assertCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
138 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
139 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
140 |
{ |
32991
b27c76b82713
8134853: Bulk integration of java.util.concurrent classes
dl
parents:
28667
diff
changeset
|
141 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize(l.iterator(), 0); |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
142 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
143 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
144 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
145 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
146 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize( |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
147 |
l.iterator(), Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
148 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
149 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
150 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
151 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
152 |
public void testSpliteratorOfIntFromIterator() { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
153 |
Supplier<PrimitiveIterator.OfInt> si = () -> IntStream.of(1, 2, 3, 4).iterator(); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
154 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
155 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
156 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
157 |
assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
158 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
159 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
160 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
161 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
162 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
163 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
164 |
assertCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
165 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
166 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
167 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
168 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize(si.get(), 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
169 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
170 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
171 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
172 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
173 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize( |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
174 |
si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
175 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
176 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
177 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
178 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
179 |
public void testSpliteratorOfLongFromIterator() { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
180 |
Supplier<PrimitiveIterator.OfLong> si = () -> LongStream.of(1, 2, 3, 4).iterator(); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
181 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
182 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
183 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
184 |
assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
185 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
186 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
187 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
188 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
189 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
190 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
191 |
assertCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
192 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
193 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
194 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
195 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize(si.get(), 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
196 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
197 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
198 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
199 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
200 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize( |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
201 |
si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
202 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
203 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
204 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
205 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
206 |
public void testSpliteratorOfDoubleFromIterator() { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
207 |
Supplier<PrimitiveIterator.OfDouble> si = () -> DoubleStream.of(1, 2, 3, 4).iterator(); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
208 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
209 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
210 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
211 |
assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
212 |
assertHasNotCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
213 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
214 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
215 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
216 |
Spliterator<?> s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
217 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
218 |
assertCharacteristics(s, Spliterator.CONCURRENT); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
219 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
220 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
221 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
222 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize(si.get(), 0); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
223 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
224 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
225 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
226 |
{ |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
227 |
Spliterator<?> s = Spliterators.spliteratorUnknownSize( |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
228 |
si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
229 |
assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
230 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
231 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
232 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
233 |
// |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
234 |
|
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
235 |
public void testHashMap() { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
236 |
assertMapCharacteristics(new HashMap<>(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
237 |
Spliterator.SIZED | Spliterator.DISTINCT); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
238 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
239 |
|
20489
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
240 |
public void testWeakHashMap() { |
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
241 |
assertMapCharacteristics(new WeakHashMap<>(), |
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
242 |
Spliterator.DISTINCT); |
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
243 |
} |
cce02e4a6cbe
8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents:
20183
diff
changeset
|
244 |
|
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
245 |
public void testHashSet() { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
246 |
assertSetCharacteristics(new HashSet<>(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
247 |
Spliterator.SIZED | Spliterator.DISTINCT); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
248 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
249 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
250 |
public void testLinkedHashMap() { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
251 |
assertMapCharacteristics(new LinkedHashMap<>(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
252 |
Spliterator.SIZED | Spliterator.DISTINCT | |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
253 |
Spliterator.ORDERED); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
254 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
255 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
256 |
public void testLinkedHashSet() { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
257 |
assertSetCharacteristics(new LinkedHashSet<>(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
258 |
Spliterator.SIZED | Spliterator.DISTINCT | |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
259 |
Spliterator.ORDERED); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
260 |
} |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
261 |
|
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
262 |
public void testTreeMap() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
263 |
assertSortedMapCharacteristics(new TreeMap<>(), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
264 |
Spliterator.SIZED | Spliterator.DISTINCT | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
265 |
Spliterator.SORTED | Spliterator.ORDERED); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
266 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
267 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
268 |
public void testTreeMapWithComparator() { |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
269 |
assertSortedMapCharacteristics(new TreeMap<>(Comparator.reverseOrder()), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
270 |
Spliterator.SIZED | Spliterator.DISTINCT | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
271 |
Spliterator.SORTED | Spliterator.ORDERED); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
272 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
273 |
|
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
274 |
public void testTreeSet() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
275 |
assertSortedSetCharacteristics(new TreeSet<>(), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
276 |
Spliterator.SIZED | Spliterator.DISTINCT | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
277 |
Spliterator.SORTED | Spliterator.ORDERED); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
278 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
279 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
280 |
public void testTreeSetWithComparator() { |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
281 |
assertSortedSetCharacteristics(new TreeSet<>(Comparator.reverseOrder()), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
282 |
Spliterator.SIZED | Spliterator.DISTINCT | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
283 |
Spliterator.SORTED | Spliterator.ORDERED); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
284 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
285 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
286 |
public void testConcurrentSkipListMap() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
287 |
assertSortedMapCharacteristics(new ConcurrentSkipListMap<>(), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
288 |
Spliterator.CONCURRENT | Spliterator.NONNULL | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
289 |
Spliterator.DISTINCT | Spliterator.SORTED | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
290 |
Spliterator.ORDERED); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
291 |
} |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
292 |
|
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
293 |
public void testConcurrentSkipListMapWithComparator() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
294 |
assertSortedMapCharacteristics(new ConcurrentSkipListMap<>(Comparator.<Integer>reverseOrder()), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
295 |
Spliterator.CONCURRENT | Spliterator.NONNULL | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
296 |
Spliterator.DISTINCT | Spliterator.SORTED | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
297 |
Spliterator.ORDERED); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
298 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
299 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
300 |
public void testConcurrentSkipListSet() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
301 |
assertSortedSetCharacteristics(new ConcurrentSkipListSet<>(), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
302 |
Spliterator.CONCURRENT | Spliterator.NONNULL | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
303 |
Spliterator.DISTINCT | Spliterator.SORTED | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
304 |
Spliterator.ORDERED); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
305 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
306 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
307 |
public void testConcurrentSkipListSetWithComparator() { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
308 |
assertSortedSetCharacteristics(new ConcurrentSkipListSet<>(Comparator.reverseOrder()), |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
309 |
Spliterator.CONCURRENT | Spliterator.NONNULL | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
310 |
Spliterator.DISTINCT | Spliterator.SORTED | |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
311 |
Spliterator.ORDERED); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
312 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
313 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
314 |
|
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
315 |
// |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
316 |
|
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
317 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
318 |
void assertMapCharacteristics(Map<Integer, String> m, int keyCharacteristics) { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
319 |
assertMapCharacteristics(m, keyCharacteristics, 0); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
320 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
321 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
322 |
void assertMapCharacteristics(Map<Integer, String> m, int keyCharacteristics, int notValueCharacteristics) { |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
323 |
initMap(m); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
324 |
|
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
325 |
assertCharacteristics(m.keySet(), keyCharacteristics); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
326 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
327 |
assertCharacteristics(m.values(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
328 |
keyCharacteristics & ~(Spliterator.DISTINCT | notValueCharacteristics)); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
329 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
330 |
assertCharacteristics(m.entrySet(), keyCharacteristics); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
331 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
332 |
if ((keyCharacteristics & Spliterator.SORTED) == 0) { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
333 |
assertISEComparator(m.keySet()); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
334 |
assertISEComparator(m.values()); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
335 |
assertISEComparator(m.entrySet()); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
336 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
337 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
338 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
339 |
void assertSetCharacteristics(Set<Integer> s, int keyCharacteristics) { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
340 |
initSet(s); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
341 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
342 |
assertCharacteristics(s, keyCharacteristics); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
343 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
344 |
if ((keyCharacteristics & Spliterator.SORTED) == 0) { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
345 |
assertISEComparator(s); |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
346 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
347 |
} |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
348 |
|
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
349 |
void assertSortedMapCharacteristics(SortedMap<Integer, String> m, int keyCharacteristics) { |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
350 |
assertMapCharacteristics(m, keyCharacteristics, Spliterator.SORTED); |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
351 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
352 |
Set<Integer> keys = m.keySet(); |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
353 |
if (m.comparator() != null) { |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
354 |
assertNotNullComparator(keys); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
355 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
356 |
else { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
357 |
assertNullComparator(keys); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
358 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
359 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
360 |
assertISEComparator(m.values()); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
361 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
362 |
assertNotNullComparator(m.entrySet()); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
363 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
364 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
365 |
void assertSortedSetCharacteristics(SortedSet<Integer> s, int keyCharacteristics) { |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
366 |
assertSetCharacteristics(s, keyCharacteristics); |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
367 |
|
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
368 |
if (s.comparator() != null) { |
19378
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
369 |
assertNotNullComparator(s); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
370 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
371 |
else { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
372 |
assertNullComparator(s); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
373 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
374 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
375 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
376 |
void initMap(Map<Integer, String> m) { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
377 |
m.put(1, "4"); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
378 |
m.put(2, "3"); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
379 |
m.put(3, "2"); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
380 |
m.put(4, "1"); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
381 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
382 |
|
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
383 |
void initSet(Set<Integer> s) { |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
384 |
s.addAll(Arrays.asList(1, 2, 3, 4)); |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
385 |
} |
0b98a290dd86
8022326: Spliterator for values of j.u.c.ConcurrentSkipListMap does not report ORDERED
psandoz
parents:
19065
diff
changeset
|
386 |
|
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
387 |
void assertCharacteristics(Collection<?> c, int expectedCharacteristics) { |
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
388 |
assertCharacteristics(c.spliterator(), expectedCharacteristics); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
389 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
390 |
|
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
391 |
void assertCharacteristics(Spliterator<?> s, int expectedCharacteristics) { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
392 |
assertTrue(s.hasCharacteristics(expectedCharacteristics), |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
393 |
"Spliterator characteristics"); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
394 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
395 |
|
20183
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
396 |
void assertHasNotCharacteristics(Spliterator<?> s, int expectedCharacteristics) { |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
397 |
assertFalse(s.hasCharacteristics(expectedCharacteristics), |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
398 |
"Spliterator characteristics"); |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
399 |
} |
584504d38d79
8024405: Spliterators.spliterator should support CONCURRENT characteristic
psandoz
parents:
19806
diff
changeset
|
400 |
|
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
401 |
void assertNullComparator(Collection<?> c) { |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
402 |
assertNull(c.spliterator().getComparator(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
403 |
"Comparator of Spliterator of Collection"); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
404 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
405 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
406 |
void assertNotNullComparator(Collection<?> c) { |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
407 |
assertNotNull(c.spliterator().getComparator(), |
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
408 |
"Comparator of Spliterator of Collection"); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
409 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
410 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
411 |
void assertISEComparator(Collection<?> c) { |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
412 |
assertISEComparator(c.spliterator()); |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
413 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
414 |
|
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
415 |
void assertISEComparator(Spliterator<?> s) { |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
416 |
boolean caught = false; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
417 |
try { |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
418 |
s.getComparator(); |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
419 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
420 |
catch (IllegalStateException e) { |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
421 |
caught = true; |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
422 |
} |
19806
dda89341ee2d
8023463: Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
psandoz
parents:
19378
diff
changeset
|
423 |
assertTrue(caught, "Throwing IllegalStateException"); |
19065
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
424 |
} |
f7c941aa63ee
8020156: TreeMap.values().spliterator() does not report ORDERED
psandoz
parents:
diff
changeset
|
425 |
} |