Skip to content

Spliterators utility class

The Spliterators utility class is part of the Java Stream API, specifically serving as a utility class containing static methods for working with Spliterator instances^[600-developer__java__java8__java8-Spliterator.md].

It provides implementations for primitive specializations such as OfInt, OfLong, and OfDouble, which are designed to handle primitive values efficiently without the overhead of boxing operations^[600-developer__java__java8__java8-Spliterator.md].

Spliterator characteristics

The behavior of a Spliterator is defined by a set of bit-mask values representing its characteristics. The Spliterators class defines these constants, which can be combined to describe the data source^[600-developer__java__java8__java8-Spliterator.md].

  • ORDERED (0x00000010): Indicates that elements have an encounter order^[600-developer__java__java8__java8-Spliterator.md].
  • DISTINCT (0x00000001): Indicates that for each pair of elements x and y, !x.equals(y)^[600-developer__java__java8__java8-Spliterator.md].
  • SORTED (0x00000004): Indicates that the traversal follows a defined sort order^[600-developer__java__java8__java8-Spliterator.md].
  • SIZED (0x00000040): Indicates that the estimated size is known and accurate^[600-developer__java__java8__java8-Spliterator.md].
  • NONNULL (0x00000100): Indicates that the source guarantees that encountered elements will not be null^[600-developer__java__java8__java8-Spliterator.md].
  • IMMUTABLE (0x00000400): Indicates that the element source cannot be structurally modified^[600-developer__java__java8__java8-Spliterator.md].
  • CONCURRENT (0x00001000): Indicates that the element source may be safely concurrently modified^[600-developer__java__java8__java8-Spliterator.md].
  • SUBSIZED (0x00004000): Indicates that all remaining Spliterators are SIZED^[600-developer__java__java8__java8-Spliterator.md].

Sources

  • 600-developer__java__java8__java8-Spliterator.md