-
Sub-task
-
Resolution: Duplicate
-
P2
-
None
-
None
Consider the following code:
Stream<String> stream = new TreeMap<String, String>() {{
put("c", "c");
put("d", "d");
put("e", "e");
put("b", "b");
put("a", "a");
}}.values().parallelStream();
Stream limit = (Stream)stream.limit(3);
Object[] objects = limit.toArray();
System.out.println(Arrays.toString(objects));
The output will be unexpected:
[b, c, d]
Issue is reproduced with different sets of data.
The following JCK tests will fail:
api/java_util/TreeMap/ValuesParallelStream.html#ValuesParallelStream[checkLimit]
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkLimit]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkLimit]
Stream<String> stream = new TreeMap<String, String>() {{
put("c", "c");
put("d", "d");
put("e", "e");
put("b", "b");
put("a", "a");
}}.values().parallelStream();
Stream limit = (Stream)stream.limit(3);
Object[] objects = limit.toArray();
System.out.println(Arrays.toString(objects));
The output will be unexpected:
[b, c, d]
Issue is reproduced with different sets of data.
The following JCK tests will fail:
api/java_util/TreeMap/ValuesParallelStream.html#ValuesParallelStream[checkLimit]
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkLimit]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkLimit]
- duplicates
-
JDK-8020156 TreeMap.values().spliterator() does not report ORDERED
-
- Closed
-