Language

SpliteratorCharacteristics Enum

Definition

Specifies the source and traversal properties reported by a spliterator.

public enum SpliteratorCharacteristics
type SpliteratorCharacteristics = 
Inheritance
SpliteratorCharacteristics

Fields

Name Value Description
Distinct 1

Indicates that no two encountered elements are equal under Java equality. A spliterator with this characteristic can contain at most one null element. For example, a spliterator based on a set can report this characteristic.

Java reference for java.util.Spliterator.DISTINCT.

Sorted 4

Encounter order follows a defined sort order. Comparator returns the associated comparator, or null if all elements are comparable and sorted by their natural order. A spliterator that reports Sorted must also report Ordered.

Java reference for java.util.Spliterator.SORTED.

Ordered 16

An encounter order is defined for the elements. TrySplit() splits a strict prefix, TryAdvance(IConsumer) advances one element in prefix order, and ForEachRemaining(IConsumer) performs actions in encounter order. A collection has an encounter order if its Iterator() method documents an order; the encounter order is the same as that order. Otherwise, the collection has no encounter order.

Java reference for java.util.Spliterator.ORDERED.

Sized 64

The value returned by EstimateSize() before traversal or splitting is a finite size. If the source is not structurally modified, it is the exact number of elements that a complete traversal would encounter.

Java reference for java.util.Spliterator.SIZED.

Nonnull 256

Characteristic value signifying that the source guarantees that encountered elements will not be null. (This applies, for example, to most concurrent collections, queues, and maps.)

Java reference for java.util.Spliterator.NONNULL.

Immutable 1024

The element source cannot be structurally modified: elements cannot be added, replaced, or removed during traversal. A spliterator that reports neither Immutable nor Concurrent should document its policy for structural interference detected during traversal, such as throwing ConcurrentModificationException.

Java reference for java.util.Spliterator.IMMUTABLE.

Concurrent 4096

The element source can be modified concurrently by multiple threads without external synchronization. The spliterator should document the effect of modifications during traversal. A top-level spliterator should not report both Concurrent and Sized, because its size can change during traversal. A sub-spliterator can report Sized if its size is known and traversal does not reflect additions or removals. A top-level spliterator should not report both Concurrent and Immutable, because they are mutually exclusive. A sub-spliterator can report Immutable if traversal does not reflect additions or removals. A top-level spliterator with either inconsistent combination provides no guarantees for computations that use it.

Java reference for java.util.Spliterator.CONCURRENT.

Subsized 16384

All spliterators returned by TrySplit() report both Sized and Subsized. This includes direct and indirect child spliterators. A spliterator that reports Subsized without Sized is inconsistent and provides no guarantees for computations that use it.

Java reference for java.util.Spliterator.SUBSIZED.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to