Skip to content

Spliterator characteristics

The Spliterator interface in Java defines a set of bit-mask values known as characteristics to describe the properties of a data source and how it can be traversed or partitioned.^[600-developer__java__java8__java8-Spliterator.md]

These characteristics are used by stream operations to optimize execution and impose constraints on the data.^[600-developer__java__java8__java8-Spliterator.md]

Standard characteristics

The following constants are defined in the Spliterator interface^[600-developer__java__java8__java8-Spliterator.md]:

  • ORDERED (0x00000010): Indicates that the elements have an encounter order.
  • DISTINCT (0x00000001): Indicates that each element encountered is unique.
  • SORTED (0x00000004): Indicates that the elements are encountered in a sorted order.
  • SIZED (0x00000040): Indicates that the Spliterator reports an exact size value.
  • NONNULL (0x00000100): Indicates that the source guarantees that encountered elements will not be null.
  • IMMUTABLE (0x00000400): Indicates that the element source cannot be structurally modified.
  • CONCURRENT (0x00001000): Indicates that the element source may be safely modified concurrently.
  • SUBSIZED (0x00004000): Indicates that all remaining Spliterators resulting from a trySplit() operation are SIZED.

Sources

  • 600-developer__java__java8__java8-Spliterator.md