OfPrimitive

Base interface for Spliterators specialized for primitive values.

Type Parameters

T

The wrapper type (e.g., Int, Long, Double).

T_CONS

The primitive consumer function type (e.g., (Int) -> Unit).

T_SPLITR

The concrete primitive Spliterator type (e.g., OfInt).

Inheritors

Functions

Link copied to clipboard
abstract fun characteristics(): Int

Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from the constants defined in the companion object (ORDERED, DISTINCT, etc.).

Link copied to clipboard
abstract fun estimateSize(): Long

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or Long.MAX_VALUE if infinite, unknown, or too expensive to compute.

Link copied to clipboard
open fun forEachRemaining(action: T_CONS)

Primitive-specific version of forEachRemaining.

open override fun forEachRemaining(action: (T) -> Unit)

Generic forEachRemaining implementation for primitive spliterators. Default behavior adapts the generic consumer to the primitive one, potentially causing boxing.

Link copied to clipboard
open fun getComparator(): Comparator<in T>?

If SORTED by a Comparator, returns that Comparator. If SORTED in natural order, returns null. Otherwise (not SORTED), throws IllegalStateException.

Link copied to clipboard

Convenience method returning estimateSize if SIZED, else -1L.

Link copied to clipboard
open fun hasCharacteristics(characteristics: Int): Boolean

Returns true if this Spliterator's characteristics contain all of the given characteristics.

Link copied to clipboard
abstract fun tryAdvance(action: T_CONS): Boolean

Primitive-specific version of tryAdvance.

open override fun tryAdvance(action: (T) -> Unit): Boolean

Generic tryAdvance implementation for primitive spliterators. Default behavior adapts the generic consumer to the primitive one, potentially causing boxing.

Link copied to clipboard
abstract override fun trySplit(): T_SPLITR?

If this spliterator can be partitioned, returns a Spliterator covering elements that will, upon return, not be covered by this Spliterator.