spliterator

fun <T> spliterator(array: Array<T?>, fromIndex: Int, toIndex: Int, additionalCharacteristics: Int): Spliterator<T>

Creates a 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.

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.

Return

A spliterator for an array

Parameters

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 always reported

See also

Arrays.spliterator

Throws

if the given array is null

ArrayIndexOutOfBoundsException

if fromIndex is negative, toIndex is less than fromIndex, or toIndex is greater than the array size