Q60: What is a Spliterator in Java 8?

Spliterator (Splittable Iterator) traverses and splits elements of a data source. It powers the Stream API.

  • Key Methods: tryAdvance() (processes next single element), trySplit() (splits prefix portion into a new Spliterator for parallel thread execution), estimateSize(), characteristics().
Key Takeaways
  • Spliterator splits streams for parallel thread processing via trySplit().
Knowledge Check

Which method in Spliterator splits off a subset of elements to enable parallel stream processing?