-
Sub-task
-
Resolution: Duplicate
-
P2
-
None
-
8
-
b97
Consider the following code sample:
Stream<Double> stream = new TreeMap<Double, Double>() {{
put(41.0, 41.0);
put(10.0, 10.0);
put(33.0, 33.0);
put(22.0, 22.0);
}}.values().stream();
Stream parallel = (Stream)stream.distinct().parallel();
Iterator iterator = parallel.iterator();
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
The output is not perfectly expected as the ascending order is not present:
next = 22.0
next = 41.0
next = 33.0
next = 10.0
Exception in thread "main" java.util.NoSuchElementException
at java.util.Spliterators$1Adapter.next(Spliterators.java:688)
The following JCK tests will fail due to this:
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkDistinct]
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueStream[checkDistinct]
api/java_util/TreeMap/ValuesStream.html#ValuesStream[checkDistinct]
api/java_util/TreeMap/ValuesParallelStream.html#ValuesParallelStream[checkDistinct]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueStream[checkDistinct]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkDistinct]
Stream<Double> stream = new TreeMap<Double, Double>() {{
put(41.0, 41.0);
put(10.0, 10.0);
put(33.0, 33.0);
put(22.0, 22.0);
}}.values().stream();
Stream parallel = (Stream)stream.distinct().parallel();
Iterator iterator = parallel.iterator();
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
System.out.println("next = " + iterator.next());
The output is not perfectly expected as the ascending order is not present:
next = 22.0
next = 41.0
next = 33.0
next = 10.0
Exception in thread "main" java.util.NoSuchElementException
at java.util.Spliterators$1Adapter.next(Spliterators.java:688)
The following JCK tests will fail due to this:
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkDistinct]
api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueStream[checkDistinct]
api/java_util/TreeMap/ValuesStream.html#ValuesStream[checkDistinct]
api/java_util/TreeMap/ValuesParallelStream.html#ValuesParallelStream[checkDistinct]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueStream[checkDistinct]
api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkDistinct]
- duplicates
-
JDK-8020156 TreeMap.values().spliterator() does not report ORDERED
-
- Closed
-