--- a/jdk/src/share/classes/java/util/Spliterators.java Wed Sep 18 10:49:34 2013 -0700
+++ b/jdk/src/share/classes/java/util/Spliterators.java Thu Sep 19 20:41:54 2013 -0700
@@ -409,16 +409,16 @@
*
* @param <T> Type of elements
* @param c The collection
- * @param additionalCharacteristics Additional spliterator characteristics
- * of this spliterator's source or elements beyond {@code SIZED} and
- * {@code SUBSIZED} which are are always reported
+ * @param characteristics Characteristics of this spliterator's source or
+ * elements. The characteristics {@code SIZED} and {@code SUBSIZED}
+ * are additionally reported unless {@code CONCURRENT} is supplied.
* @return A spliterator from an iterator
* @throws NullPointerException if the given collection is {@code null}
*/
public static <T> Spliterator<T> spliterator(Collection<? extends T> c,
- int additionalCharacteristics) {
+ int characteristics) {
return new IteratorSpliterator<>(Objects.requireNonNull(c),
- additionalCharacteristics);
+ characteristics);
}
/**
@@ -439,17 +439,17 @@
* @param iterator The iterator for the source
* @param size The number of elements in the source, to be reported as
* initial {@code estimateSize}
- * @param additionalCharacteristics Additional spliterator characteristics
- * of this spliterator's source or elements beyond {@code SIZED} and
- * {@code SUBSIZED} which are are always reported
+ * @param characteristics Characteristics of this spliterator's source or
+ * elements. The characteristics {@code SIZED} and {@code SUBSIZED}
+ * are additionally reported unless {@code CONCURRENT} is supplied.
* @return A spliterator from an iterator
* @throws NullPointerException if the given iterator is {@code null}
*/
public static <T> Spliterator<T> spliterator(Iterator<? extends T> iterator,
long size,
- int additionalCharacteristics) {
+ int characteristics) {
return new IteratorSpliterator<>(Objects.requireNonNull(iterator), size,
- additionalCharacteristics);
+ characteristics);
}
/**
@@ -467,7 +467,7 @@
*
* @param <T> Type of elements
* @param iterator The iterator for the source
- * @param characteristics Properties of this spliterator's source
+ * @param characteristics Characteristics of this spliterator's source
* or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are
* ignored and are not reported.)
* @return A spliterator from an iterator
@@ -496,17 +496,17 @@
* @param iterator The iterator for the source
* @param size The number of elements in the source, to be reported as
* initial {@code estimateSize}.
- * @param additionalCharacteristics Additional spliterator characteristics
- * of this spliterator's source or elements beyond {@code SIZED} and
- * {@code SUBSIZED} which are are always reported
+ * @param characteristics Characteristics of this spliterator's source or
+ * elements. The characteristics {@code SIZED} and {@code SUBSIZED}
+ * are additionally reported unless {@code CONCURRENT} is supplied.
* @return A spliterator from an iterator
* @throws NullPointerException if the given iterator is {@code null}
*/
public static Spliterator.OfInt spliterator(PrimitiveIterator.OfInt iterator,
long size,
- int additionalCharacteristics) {
+ int characteristics) {
return new IntIteratorSpliterator(Objects.requireNonNull(iterator),
- size, additionalCharacteristics);
+ size, characteristics);
}
/**
@@ -524,7 +524,7 @@
* operated on after the spliterator is returned.
*
* @param iterator The iterator for the source
- * @param characteristics Properties of this spliterator's source
+ * @param characteristics Characteristics of this spliterator's source
* or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are
* ignored and are not reported.)
* @return A spliterator from an iterator
@@ -553,17 +553,17 @@
* @param iterator The iterator for the source
* @param size The number of elements in the source, to be reported as
* initial {@code estimateSize}.
- * @param additionalCharacteristics Additional spliterator characteristics
- * of this spliterator's source or elements beyond {@code SIZED} and
- * {@code SUBSIZED} which are are always reported
+ * @param characteristics Characteristics of this spliterator's source or
+ * elements. The characteristics {@code SIZED} and {@code SUBSIZED}
+ * are additionally reported unless {@code CONCURRENT} is supplied.
* @return A spliterator from an iterator
* @throws NullPointerException if the given iterator is {@code null}
*/
public static Spliterator.OfLong spliterator(PrimitiveIterator.OfLong iterator,
long size,
- int additionalCharacteristics) {
+ int characteristics) {
return new LongIteratorSpliterator(Objects.requireNonNull(iterator),
- size, additionalCharacteristics);
+ size, characteristics);
}
/**
@@ -581,7 +581,7 @@
* operated on after the spliterator is returned.
*
* @param iterator The iterator for the source
- * @param characteristics Properties of this spliterator's source
+ * @param characteristics Characteristics of this spliterator's source
* or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are
* ignored and are not reported.)
* @return A spliterator from an iterator
@@ -610,17 +610,17 @@
* @param iterator The iterator for the source
* @param size The number of elements in the source, to be reported as
* initial {@code estimateSize}
- * @param additionalCharacteristics Additional spliterator characteristics
- * of this spliterator's source or elements beyond {@code SIZED} and
- * {@code SUBSIZED} which are are always reported
+ * @param characteristics Characteristics of this spliterator's source or
+ * elements. The characteristics {@code SIZED} and {@code SUBSIZED}
+ * are additionally reported unless {@code CONCURRENT} is supplied.
* @return A spliterator from an iterator
* @throws NullPointerException if the given iterator is {@code null}
*/
public static Spliterator.OfDouble spliterator(PrimitiveIterator.OfDouble iterator,
long size,
- int additionalCharacteristics) {
+ int characteristics) {
return new DoubleIteratorSpliterator(Objects.requireNonNull(iterator),
- size, additionalCharacteristics);
+ size, characteristics);
}
/**
@@ -638,7 +638,7 @@
* operated on after the spliterator is returned.
*
* @param iterator The iterator for the source
- * @param characteristics Properties of this spliterator's source
+ * @param characteristics Characteristics of this spliterator's source
* or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are
* ignored and are not reported.)
* @return A spliterator from an iterator
@@ -1710,7 +1710,9 @@
public IteratorSpliterator(Collection<? extends T> collection, int characteristics) {
this.collection = collection;
this.it = null;
- this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED;
+ this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0
+ ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED
+ : characteristics;
}
/**
@@ -1727,7 +1729,9 @@
this.collection = null;
this.it = iterator;
this.est = size;
- this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED;
+ this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0
+ ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED
+ : characteristics;
}
/**
@@ -1857,7 +1861,9 @@
public IntIteratorSpliterator(PrimitiveIterator.OfInt iterator, long size, int characteristics) {
this.it = iterator;
this.est = size;
- this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED;
+ this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0
+ ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED
+ : characteristics;
}
/**
@@ -1949,7 +1955,9 @@
public LongIteratorSpliterator(PrimitiveIterator.OfLong iterator, long size, int characteristics) {
this.it = iterator;
this.est = size;
- this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED;
+ this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0
+ ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED
+ : characteristics;
}
/**
@@ -2041,7 +2049,9 @@
public DoubleIteratorSpliterator(PrimitiveIterator.OfDouble iterator, long size, int characteristics) {
this.it = iterator;
this.est = size;
- this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED;
+ this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0
+ ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED
+ : characteristics;
}
/**