public final class Spliterators extends Object
Spliterator and its primitive specializations
Spliterator.OfInt, Spliterator.OfLong, and
Spliterator.OfDouble.Spliterator| Modifier and Type | Class and Description |
|---|---|
static class |
Spliterators.AbstractDoubleSpliterator
An abstract
Spliterator.OfDouble that implements
trySplit to permit limited parallelism. |
static class |
Spliterators.AbstractIntSpliterator
An abstract
Spliterator.OfInt that implements trySplit to
permit limited parallelism. |
static class |
Spliterators.AbstractLongSpliterator
An abstract
Spliterator.OfLong that implements trySplit
to permit limited parallelism. |
static class |
Spliterators.AbstractSpliterator<T>
An abstract
Spliterator that implements trySplit to
permit limited parallelism. |
static class |
Spliterators.OfDouble
Static default implementations for the Java 8 default methods of
Spliterator.OfDouble |
static class |
Spliterators.OfInt
Static default implementations for the Java 8 default methods of
Spliterator.OfInt |
static class |
Spliterators.OfLong
Static default implementations for the Java 8 default methods of
Spliterator.OfLong |
static class |
Spliterators.OfPrimitive
Static default implementations for the Java 8 default method of
Spliterator.OfPrimitive |
| Modifier and Type | Method and Description |
|---|---|
static Spliterator.OfDouble |
emptyDoubleSpliterator()
Creates an empty
Spliterator.OfDouble
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. |
static Spliterator.OfInt |
emptyIntSpliterator()
Creates an empty
Spliterator.OfInt
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. |
static Spliterator.OfLong |
emptyLongSpliterator()
Creates an empty
Spliterator.OfLong
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. |
static <T> Spliterator<T> |
emptySpliterator()
Creates an empty
Spliterator
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. |
static <T> void |
forEachRemaining(Spliterator<T> this_,
Consumer<? super T> action)
Performs the given action for each remaining element, sequentially in
the current thread, until all elements have been processed or the action
throws an exception.
|
static <T> Comparator<? super T> |
getComparator(Spliterator<T> this_)
|
static <T> long |
getExactSizeIfKnown(Spliterator<T> this_)
Convenience method that returns
Spliterator.estimateSize() if the
this_ Spliterator is Spliterator.SIZED, else -1. |
static <T> boolean |
hasCharacteristics(Spliterator<T> this_,
int characteristics)
Returns
true if the this_ Spliterator's Spliterator.characteristics() contain all of the given characteristics. |
static PrimitiveIterator.OfDouble |
iterator(Spliterator.OfDouble spliterator)
Creates an
PrimitiveIterator.OfDouble from a
Spliterator.OfDouble. |
static PrimitiveIterator.OfInt |
iterator(Spliterator.OfInt spliterator)
Creates an
PrimitiveIterator.OfInt from a
Spliterator.OfInt. |
static PrimitiveIterator.OfLong |
iterator(Spliterator.OfLong spliterator)
Creates an
PrimitiveIterator.OfLong from a
Spliterator.OfLong. |
static <T> Iterator<T> |
iterator(Spliterator<? extends T> spliterator)
Creates an
Iterator from a Spliterator. |
static <T> Spliterator<T> |
spliterator(Collection<? extends T> c)
Creates either a specialized
Spliterator (effectively the same
one that Java 8 uses) for the given collection provided it is one of the
types listed below or a Spliterator using the given collection's
Collection.iterator() as the source of elements, and
reporting its Collection.size() as its initial size. |
static <T> Spliterator<T> |
spliterator(Collection<? extends T> c,
int characteristics)
Creates a
Spliterator using the given collection's
Collection.iterator() as the source of elements, and
reporting its Collection.size() as its initial size. |
static Spliterator.OfDouble |
spliterator(double[] array,
int additionalCharacteristics)
Creates a
Spliterator.OfDouble covering the elements of a given array,
using a customized set of spliterator characteristics. |
static Spliterator.OfDouble |
spliterator(double[] array,
int fromIndex,
int toIndex,
int additionalCharacteristics)
Creates a
Spliterator.OfDouble covering a range of elements of a
given array, using a customized set of spliterator characteristics. |
static Spliterator.OfInt |
spliterator(int[] array,
int additionalCharacteristics)
Creates a
Spliterator.OfInt covering the elements of a given array,
using a customized set of spliterator characteristics. |
static Spliterator.OfInt |
spliterator(int[] array,
int fromIndex,
int toIndex,
int additionalCharacteristics)
Creates a
Spliterator.OfInt covering a range of elements of a
given array, using a customized set of spliterator characteristics. |
static <T> Spliterator<T> |
spliterator(Iterator<? extends T> iterator,
long size,
int characteristics)
Creates a
Spliterator using a given Iterator
as the source of elements, and with a given initially reported size. |
static Spliterator.OfLong |
spliterator(long[] array,
int additionalCharacteristics)
Creates a
Spliterator.OfLong covering the elements of a given array,
using a customized set of spliterator characteristics. |
static Spliterator.OfLong |
spliterator(long[] array,
int fromIndex,
int toIndex,
int additionalCharacteristics)
Creates a
Spliterator.OfLong covering a range of elements of a
given array, using a customized set of spliterator characteristics. |
static <T> Spliterator<T> |
spliterator(Object[] array,
int additionalCharacteristics)
Creates a
Spliterator covering the elements of a given array,
using a customized set of spliterator characteristics. |
static <T> Spliterator<T> |
spliterator(Object[] array,
int fromIndex,
int toIndex,
int additionalCharacteristics)
Creates a
Spliterator covering a range of elements of a given
array, using a customized set of spliterator characteristics. |
static Spliterator.OfDouble |
spliterator(PrimitiveIterator.OfDouble iterator,
long size,
int characteristics)
Creates a
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, and with a
given initially reported size. |
static Spliterator.OfInt |
spliterator(PrimitiveIterator.OfInt iterator,
long size,
int characteristics)
Creates a
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, and with a given
initially reported size. |
static Spliterator.OfLong |
spliterator(PrimitiveIterator.OfLong iterator,
long size,
int characteristics)
Creates a
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, and with a
given initially reported size. |
static <T> Spliterator<T> |
spliteratorUnknownSize(Iterator<? extends T> iterator,
int characteristics)
Creates a
Spliterator using a given Iterator
as the source of elements, with no initial size estimate. |
static Spliterator.OfDouble |
spliteratorUnknownSize(PrimitiveIterator.OfDouble iterator,
int characteristics)
Creates a
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, with no
initial size estimate. |
static Spliterator.OfInt |
spliteratorUnknownSize(PrimitiveIterator.OfInt iterator,
int characteristics)
Creates a
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, with no initial
size estimate. |
static Spliterator.OfLong |
spliteratorUnknownSize(PrimitiveIterator.OfLong iterator,
int characteristics)
Creates a
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, with no
initial size estimate. |
public static <T> void forEachRemaining(Spliterator<T> this_, Consumer<? super T> action)
this_ Spliterator is
Spliterator.ORDERED, actions are performed in encounter order.
Exceptions thrown by the action are relayed to the caller.
Implementation Requirements:
The default implementation repeatedly invokes Spliterator.tryAdvance(java8.util.function.Consumer<? super T>) until
it returns false. It should be overridden whenever possible.
T - the type of elements returned by the passed Spliteratorthis_ - the Spliterator whose remaining elements should be processedaction - The actionNullPointerException - if the specified action is nullpublic static <T> long getExactSizeIfKnown(Spliterator<T> this_)
Spliterator.estimateSize() if the
this_ Spliterator is Spliterator.SIZED, else -1.
Implementation Requirements:
The default implementation returns the result of estimateSize()
if the Spliterator reports a characteristic of Spliterator#SIZED, and
-1 otherwise.
T - the type of elements returned by the passed Spliteratorthis_ - the Spliterator whose exact size should be queried-1.public static <T> boolean hasCharacteristics(Spliterator<T> this_, int characteristics)
true if the this_ Spliterator's Spliterator.characteristics() contain all of the given characteristics.
Implementation Requirements:
The default implementation returns true if the corresponding bits
of the given characteristics are set.
T - the type of elements returned by the passed Spliteratorthis_ - the Spliterator whose characteristics should be queriedcharacteristics - the characteristics to check fortrue if all the specified characteristics are present,
else falsepublic static <T> Comparator<? super T> getComparator(Spliterator<T> this_)
Spliterator.SORTED by a Comparator,
returns that Comparator. If the source is SORTED in
natural order, returns null. Otherwise,
if the source is not SORTED, throws IllegalStateException.
Implementation Requirements:
The default implementation always throws IllegalStateException.
T - the type of elements returned by the passed Spliteratorthis_ - the Spliterator for which a Comparator is requestednull if the elements are sorted in the
natural order.IllegalStateException - if the spliterator does not report
a characteristic of SORTED.public static <T> Spliterator<T> emptySpliterator()
Spliterator
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. Calls to
Spliterator.trySplit() always return null.
T - Type of elementspublic static Spliterator.OfInt emptyIntSpliterator()
Spliterator.OfInt
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. Calls to
Spliterator.trySplit() always return null.
public static Spliterator.OfLong emptyLongSpliterator()
Spliterator.OfLong
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. Calls to
Spliterator.trySplit() always return null.
public static Spliterator.OfDouble emptyDoubleSpliterator()
Spliterator.OfDouble
The empty spliterator reports Spliterator.SIZED and
Spliterator.SUBSIZED. Calls to
Spliterator.trySplit() always return null.
public static <T> Spliterator<T> spliterator(Object[] array, int additionalCharacteristics)
Spliterator covering the elements of a given array,
using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(Object[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
T - Type of elementsarray - The array, assumed to be unmodified during useadditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrays.spliterator(Object[])public static <T> Spliterator<T> spliterator(Object[] array, int fromIndex, int toIndex, int additionalCharacteristics)
Spliterator covering a range of elements of a given
array, using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(Object[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
T - Type of elementsarray - The array, assumed to be unmodified during usefromIndex - The least index (inclusive) to covertoIndex - One past the greatest index to coveradditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrayIndexOutOfBoundsException - if fromIndex is negative,
toIndex is less than fromIndex, or
toIndex is greater than the array sizeArrays.spliterator(Object[], int, int)public static Spliterator.OfInt spliterator(int[] array, int additionalCharacteristics)
Spliterator.OfInt covering the elements of a given array,
using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(int[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
array - The array, assumed to be unmodified during useadditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrays.spliterator(int[])public static Spliterator.OfInt spliterator(int[] array, int fromIndex, int toIndex, int additionalCharacteristics)
Spliterator.OfInt covering a range of elements of a
given array, using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(int[], int, int).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
array - The array, assumed to be unmodified during usefromIndex - The least index (inclusive) to covertoIndex - One past the greatest index to coveradditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrayIndexOutOfBoundsException - if fromIndex is negative,
toIndex is less than fromIndex, or
toIndex is greater than the array sizeArrays.spliterator(int[], int, int)public static Spliterator.OfLong spliterator(long[] array, int additionalCharacteristics)
Spliterator.OfLong covering the elements of a given array,
using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(long[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
array - The array, assumed to be unmodified during useadditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrays.spliterator(long[])public static Spliterator.OfLong spliterator(long[] array, int fromIndex, int toIndex, int additionalCharacteristics)
Spliterator.OfLong covering a range of elements of a
given array, using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(long[], int, int).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report. (For example, if it is
known the array will not be further modified, specify IMMUTABLE;
if the array data is considered to have an an encounter order, specify
ORDERED). The method Arrays.spliterator(long[], int, int) can
often be used instead, which returns a spliterator that reports
SIZED, SUBSIZED, IMMUTABLE, and ORDERED.
array - The array, assumed to be unmodified during usefromIndex - The least index (inclusive) to covertoIndex - One past the greatest index to coveradditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrayIndexOutOfBoundsException - if fromIndex is negative,
toIndex is less than fromIndex, or
toIndex is greater than the array sizeArrays.spliterator(long[], int, int)public static Spliterator.OfDouble spliterator(double[] array, int additionalCharacteristics)
Spliterator.OfDouble covering the elements of a given array,
using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(double[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
array - The array, assumed to be unmodified during useadditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrays.spliterator(double[])public static Spliterator.OfDouble spliterator(double[] array, int fromIndex, int toIndex, int additionalCharacteristics)
Spliterator.OfDouble covering a range of elements of a
given array, using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
Arrays.spliterator(double[], int, int).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report. (For example, if it is
known the array will not be further modified, specify IMMUTABLE;
if the array data is considered to have an an encounter order, specify
ORDERED). The method Arrays.spliterator(long[], int, int) can
often be used instead, which returns a spliterator that reports
SIZED, SUBSIZED, IMMUTABLE, and ORDERED.
array - The array, assumed to be unmodified during usefromIndex - The least index (inclusive) to covertoIndex - One past the greatest index to coveradditionalCharacteristics - Additional spliterator characteristics
of this spliterator's source or elements beyond SIZED and
SUBSIZED which are are always reportedNullPointerException - if the given array is nullArrayIndexOutOfBoundsException - if fromIndex is negative,
toIndex is less than fromIndex, or
toIndex is greater than the array sizeArrays.spliterator(double[], int, int)public static <T> Spliterator<T> spliterator(Collection<? extends T> c)
Spliterator (effectively the same
one that Java 8 uses) for the given collection provided it is one of the
types listed below or a Spliterator using the given collection's
Collection.iterator() as the source of elements, and
reporting its Collection.size() as its initial size.
In the latter case, if the given collection implements one of the
interfaces List, Set or
SortedSet the returned Spliterator will
resemble the corresponding interface default implementation of the
respective spliterator() method from Java 8. Otherwise the Java 8
default implementation of java.util.Collection.spliterator() is
used (which is essentially the same as calling
spliterator(Collection, int) with a characteristics
value equal to 0).
Particularly, if the given collection is a List, the
implementation creates a
late-binding
spliterator as follows:
RandomAccess then
the default implementation creates a spliterator that traverses
elements by invoking the method List.get(int). If
such invocation results or would result in an
IndexOutOfBoundsException then the spliterator will
fail-fast and throw a ConcurrentModificationException.
If the list is also an instance of AbstractList
then the spliterator will use the list's
modCount field to provide
additional fail-fast behavior.
Iterator. The spliterator inherits the
fail-fast of the list's iterator.
Currently, the collections that have specializations available are the following:
The Spliterators for CopyOnWriteArrayList and
CopyOnWriteArraySet provide a snapshot of the state of the
collection when the Spliterator was created, otherwise the spliterator is
late-binding, inherits
the fail-fast properties of the collection's iterator, and
implements trySplit to permit limited parallelism.
T - Type of elementsc - The collectionNullPointerException - if the given collection is nullpublic static <T> Spliterator<T> spliterator(Collection<? extends T> c, int characteristics)
Spliterator using the given collection's
Collection.iterator() as the source of elements, and
reporting its Collection.size() as its initial size.
The spliterator is
late-binding, inherits
the fail-fast properties of the collection's iterator, and
implements trySplit to permit limited parallelism.
T - Type of elementsc - The collectioncharacteristics - Characteristics of this spliterator's source or
elements. The characteristics SIZED and SUBSIZED
are additionally reported unless CONCURRENT is supplied.NullPointerException - if the given collection is nullpublic static <T> Spliterator<T> spliterator(Iterator<? extends T> iterator, long size, int characteristics)
Spliterator using a given Iterator
as the source of elements, and with a given initially reported size.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned, or the initially reported size is not equal to the actual number of elements in the source.
T - Type of elementsiterator - The iterator for the sourcesize - The number of elements in the source, to be reported as
initial estimateSizecharacteristics - Characteristics of this spliterator's source or
elements. The characteristics SIZED and SUBSIZED
are additionally reported unless CONCURRENT is supplied.NullPointerException - if the given iterator is nullpublic static <T> Spliterator<T> spliteratorUnknownSize(Iterator<? extends T> iterator, int characteristics)
Spliterator using a given Iterator
as the source of elements, with no initial size estimate.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned.
T - Type of elementsiterator - The iterator for the sourcecharacteristics - Characteristics of this spliterator's source
or elements (SIZED and SUBSIZED, if supplied, are
ignored and are not reported.)NullPointerException - if the given iterator is nullpublic static Spliterator.OfInt spliterator(PrimitiveIterator.OfInt iterator, long size, int characteristics)
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, and with a given
initially reported size.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned, or the initially reported size is not equal to the actual number of elements in the source.
iterator - The iterator for the sourcesize - The number of elements in the source, to be reported as
initial estimateSize.characteristics - Characteristics of this spliterator's source or
elements. The characteristics SIZED and SUBSIZED
are additionally reported unless CONCURRENT is supplied.NullPointerException - if the given iterator is nullpublic static Spliterator.OfInt spliteratorUnknownSize(PrimitiveIterator.OfInt iterator, int characteristics)
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, with no initial
size estimate.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned.
iterator - The iterator for the sourcecharacteristics - Characteristics of this spliterator's source
or elements (SIZED and SUBSIZED, if supplied, are
ignored and are not reported.)NullPointerException - if the given iterator is nullpublic static Spliterator.OfLong spliterator(PrimitiveIterator.OfLong iterator, long size, int characteristics)
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, and with a
given initially reported size.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned, or the initially reported size is not equal to the actual number of elements in the source.
iterator - The iterator for the sourcesize - The number of elements in the source, to be reported as
initial estimateSize.characteristics - Characteristics of this spliterator's source or
elements. The characteristics SIZED and SUBSIZED
are additionally reported unless CONCURRENT is supplied.NullPointerException - if the given iterator is nullpublic static Spliterator.OfLong spliteratorUnknownSize(PrimitiveIterator.OfLong iterator, int characteristics)
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, with no
initial size estimate.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned.
iterator - The iterator for the sourcecharacteristics - Characteristics of this spliterator's source
or elements (SIZED and SUBSIZED, if supplied, are
ignored and are not reported.)NullPointerException - if the given iterator is nullpublic static Spliterator.OfDouble spliterator(PrimitiveIterator.OfDouble iterator, long size, int characteristics)
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, and with a
given initially reported size.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned, or the initially reported size is not equal to the actual number of elements in the source.
iterator - The iterator for the sourcesize - The number of elements in the source, to be reported as
initial estimateSizecharacteristics - Characteristics of this spliterator's source or
elements. The characteristics SIZED and SUBSIZED
are additionally reported unless CONCURRENT is supplied.NullPointerException - if the given iterator is nullpublic static Spliterator.OfDouble spliteratorUnknownSize(PrimitiveIterator.OfDouble iterator, int characteristics)
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, with no
initial size estimate.
The spliterator is not
late-binding, inherits
the fail-fast properties of the iterator, and implements
trySplit to permit limited parallelism.
Traversal of elements should be accomplished through the spliterator. The behaviour of splitting and traversal is undefined if the iterator is operated on after the spliterator is returned.
iterator - The iterator for the sourcecharacteristics - Characteristics of this spliterator's source
or elements (SIZED and SUBSIZED, if supplied, are
ignored and are not reported.)NullPointerException - if the given iterator is nullpublic static <T> Iterator<T> iterator(Spliterator<? extends T> spliterator)
Iterator from a Spliterator.
Traversal of elements should be accomplished through the iterator. The behaviour of traversal is undefined if the spliterator is operated after the iterator is returned.
T - Type of elementsspliterator - The spliteratorNullPointerException - if the given spliterator is nullpublic static PrimitiveIterator.OfInt iterator(Spliterator.OfInt spliterator)
PrimitiveIterator.OfInt from a
Spliterator.OfInt.
Traversal of elements should be accomplished through the iterator. The behaviour of traversal is undefined if the spliterator is operated after the iterator is returned.
spliterator - The spliteratorNullPointerException - if the given spliterator is nullpublic static PrimitiveIterator.OfLong iterator(Spliterator.OfLong spliterator)
PrimitiveIterator.OfLong from a
Spliterator.OfLong.
Traversal of elements should be accomplished through the iterator. The behaviour of traversal is undefined if the spliterator is operated after the iterator is returned.
spliterator - The spliteratorNullPointerException - if the given spliterator is nullpublic static PrimitiveIterator.OfDouble iterator(Spliterator.OfDouble spliterator)
PrimitiveIterator.OfDouble from a
Spliterator.OfDouble.
Traversal of elements should be accomplished through the iterator. The behaviour of traversal is undefined if the spliterator is operated after the iterator is returned.
spliterator - The spliteratorNullPointerException - if the given spliterator is nullCopyright © 2016. All rights reserved.