changeset 7639:c61c4cfa4bd2

Turn Spliterator.trySplit into an abstract method.
author psandoz
date Thu, 14 Mar 2013 11:55:05 +0100
parents cf2551af0226
children 51c110b5fc26
files src/share/classes/java/util/Spliterator.java src/share/classes/java/util/TreeMap.java src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java test-ng/boottests/java/util/stream/StreamOpFlagsTest.java
diffstat 4 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Spliterator.java	Thu Mar 14 10:56:14 2013 +0100
+++ b/src/share/classes/java/util/Spliterator.java	Thu Mar 14 11:55:05 2013 +0100
@@ -247,16 +247,10 @@
      * trySplit} mechanics typically result in poor parallel
      * performance.
      *
-     * @implSpec
-     * This implementation always returns {@code null}.  It should be overridden
-     * whenever possible.
-     *
      * @return a {@code Spliterator} covering some portion of the
      * elements, or {@code null} if this spliterator cannot be split
      */
-    default Spliterator<T> trySplit() {
-        return null;
-    }
+    Spliterator<T> trySplit();
 
     /**
      * Returns an estimate of the number of elements that would be
--- a/src/share/classes/java/util/TreeMap.java	Thu Mar 14 10:56:14 2013 +0100
+++ b/src/share/classes/java/util/TreeMap.java	Thu Mar 14 11:55:05 2013 +0100
@@ -1693,7 +1693,9 @@
             public void remove() {
                 removeAscending();
             }
-
+            public Spliterator<K> trySplit() {
+                return null;
+            }
             public void forEach(Consumer<? super K> action) {
                 while (hasNext())
                     action.accept(next());
@@ -1705,16 +1707,13 @@
                 }
                 return false;
             }
-
             public int characteristics() {
                 return Spliterator.DISTINCT | Spliterator.ORDERED |
                     Spliterator.SORTED;
             }
-
             public final Comparator<? super K>  getComparator() {
                 return NavigableSubMap.this.comparator();
             }
-
         }
 
         final class DescendingSubMapKeyIterator extends SubMapIterator<K>
@@ -1729,6 +1728,9 @@
             public void remove() {
                 removeDescending();
             }
+            public Spliterator<K> trySplit() {
+                return null;
+            }
             public void forEach(Consumer<? super K> action) {
                 while (hasNext())
                     action.accept(next());
--- a/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Mar 14 10:56:14 2013 +0100
+++ b/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Mar 14 11:55:05 2013 +0100
@@ -3388,6 +3388,10 @@
                 lastReturned = null;
             }
 
+            public Spliterator<T> trySplit() {
+                return null;
+            }
+
             public boolean tryAdvance(Consumer<? super T> action) {
                 if (hasNext()) {
                     action.accept(next());
--- a/test-ng/boottests/java/util/stream/StreamOpFlagsTest.java	Thu Mar 14 10:56:14 2013 +0100
+++ b/test-ng/boottests/java/util/stream/StreamOpFlagsTest.java	Thu Mar 14 11:55:05 2013 +0100
@@ -345,6 +345,11 @@
             }
 
             @Override
+            public Spliterator<Object> trySplit() {
+                return null;
+            }
+
+            @Override
             public boolean tryAdvance(Consumer<? super Object> action) {
                 return false;
             }