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
An abstract
Spliterator.OfDouble that implements
trySplit to permit limited parallelism.
|
static class |
Spliterators
An abstract
Spliterator.OfInt that implements
trySplit to permit limited parallelism.
|
static class |
Spliterators
An abstract
Spliterator.OfLong that implements
trySplit to permit limited parallelism.
|
static class |
Spliterators
An abstract
Spliterator that implements
trySplit to permit limited parallelism.
|
| Modifier and Type | Method and Description |
|---|---|
static Spliterator |
emptyDoubleSpliterator()
Creates an empty
Spliterator.OfDouble
|
static Spliterator |
emptyIntSpliterator()
Creates an empty
Spliterator.OfInt
|
static Spliterator |
emptyLongSpliterator()
Creates an empty
Spliterator.OfLong
|
static <T> Spliterator |
emptySpliterator()
Creates an empty
Spliterator
|
static PrimitiveIterator |
iterator(Spliterator
Creates an
PrimitiveIterator.OfDouble from a
Spliterator.OfDouble.
|
static PrimitiveIterator |
iterator(Spliterator
Creates an
PrimitiveIterator.OfInt from a
Spliterator.OfInt.
|
static PrimitiveIterator |
iterator(Spliterator
Creates an
PrimitiveIterator.OfLong from a
Spliterator.OfLong.
|
static <T> Iterator |
iterator(Spliterator
Creates an
Iterator from a
Spliterator.
|
static <T> Spliterator |
spliterator(Collection
Creates a
Spliterator using the given collection's
Collection as the source of elements, and reporting its
Collection as its initial size.
|
static Spliterator |
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 |
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 |
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 |
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 |
spliterator(Iterator
Creates a
Spliterator using a given
Iterator as the source of elements, and with a given initially reported size.
|
static Spliterator |
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 |
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 |
spliterator(Object
Creates a
Spliterator covering the elements of a given array, using a customized set of spliterator characteristics.
|
static <T> Spliterator |
spliterator(Object
Creates a
Spliterator covering a range of elements of a given array, using a customized set of spliterator characteristics.
|
static Spliterator |
spliterator(PrimitiveIterator
Creates a
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, and with a given initially reported size.
|
static Spliterator |
spliterator(PrimitiveIterator
Creates a
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, and with a given initially reported size.
|
static Spliterator |
spliterator(PrimitiveIterator
Creates a
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, and with a given initially reported size.
|
static <T> Spliterator |
spliteratorUnknownSize(Iterator
Creates a
Spliterator using a given
Iterator as the source of elements, with no initial size estimate.
|
static Spliterator |
spliteratorUnknownSize(PrimitiveIterator
Creates a
Spliterator.OfDouble using a given
DoubleStream.DoubleIterator as the source of elements, with no initial size estimate.
|
static Spliterator |
spliteratorUnknownSize(PrimitiveIterator
Creates a
Spliterator.OfInt using a given
IntStream.IntIterator as the source of elements, with no initial size estimate.
|
static Spliterator |
spliteratorUnknownSize(PrimitiveIterator
Creates a
Spliterator.OfLong using a given
LongStream.LongIterator as the source of elements, with no initial size estimate.
|
public static <T> Spliterator<T> emptySpliterator()
Spliterator
The empty spliterator reports Spliterator and Spliterator. Calls to Spliterator always return null.
T - Type of elements
public static Spliterator.OfInt emptyIntSpliterator()
Spliterator.OfInt
The empty spliterator reports Spliterator and Spliterator. Calls to Spliterator always return null.
public static Spliterator.OfLong emptyLongSpliterator()
Spliterator.OfLong
The empty spliterator reports Spliterator and Spliterator. Calls to Spliterator always return null.
public static Spliterator.OfDouble emptyDoubleSpliterator()
Spliterator.OfDouble
The empty spliterator reports Spliterator and Spliterator. Calls to Spliterator 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.
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 elements
array - The array, assumed to be unmodified during use
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
Arrays.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.
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 elements
array - The array, assumed to be unmodified during use
fromIndex - The least index (inclusive) to cover
toIndex - One past the greatest index to cover
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
ArrayIndexOutOfBoundsException - if
fromIndex is negative,
toIndex is less than
fromIndex, or
toIndex is greater than the array size
Arrays.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.
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 use
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
Arrays.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.
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 use
fromIndex - The least index (inclusive) to cover
toIndex - One past the greatest index to cover
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
ArrayIndexOutOfBoundsException - if
fromIndex is negative,
toIndex is less than
fromIndex, or
toIndex is greater than the array size
Arrays.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.
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 use
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
Arrays.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.
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 can often be used instead, which returns a spliterator that reports SIZED, SUBSIZED, IMMUTABLE, and ORDERED.
array - The array, assumed to be unmodified during use
fromIndex - The least index (inclusive) to cover
toIndex - One past the greatest index to cover
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
ArrayIndexOutOfBoundsException - if
fromIndex is negative,
toIndex is less than
fromIndex, or
toIndex is greater than the array size
Arrays.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.
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 use
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
Arrays.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.
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 can often be used instead, which returns a spliterator that reports SIZED, SUBSIZED, IMMUTABLE, and ORDERED.
array - The array, assumed to be unmodified during use
fromIndex - The least index (inclusive) to cover
toIndex - One past the greatest index to cover
additionalCharacteristics - Additional spliterator characteristics of this spliterator's source or elements beyond
SIZED and
SUBSIZED which are are always reported
NullPointerException - if the given array is
null
ArrayIndexOutOfBoundsException - if
fromIndex is negative,
toIndex is less than
fromIndex, or
toIndex is greater than the array size
Arrays.spliterator(double[], int, int)
public 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 elements
c - The collection
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 collection is
null
public 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 elements
iterator - The iterator for the source
size - 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
null
public 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 elements
iterator - The iterator for the source
characteristics - 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
null
public 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 source
size - 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
null
public 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 source
characteristics - 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
null
public 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 source
size - 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
null
public 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 source
characteristics - 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
null
public 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 source
size - 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
null
public 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 source
characteristics - 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
null
public 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 elements
spliterator - The spliterator
NullPointerException - if the given spliterator is
null
public 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 spliterator
NullPointerException - if the given spliterator is
null
public 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 spliterator
NullPointerException - if the given spliterator is
null
public 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 spliterator
NullPointerException - if the given spliterator is
null