1. Overview
In this tutorial, We'll be talking about
Spliterator introduced in the new Java 8 (JDK8). Spliterator is an interface that is designed for bulk or huge datasets and provides the best performance.
Spliterator takes the data from the source and traverses it. Finally, it divides the data into partitions. Source data can be array, any collection or IO Channel such as files.
Spliterator does the partition using
trySplit() method as another Spliterator. By partitioning, Operations can be performed parallel.
A Spliterator also reports a set of characteristics() of its structure, source, and elements from among
ORDERED, DISTINCT, SORTED, SIZED, NONNULL, IMMUTABLE, CONCURRENT, and
SUBSIZED. These may be employed by Spliterator clients to control, specialize or simplify computation.
For example, a Spliterator for a Collection would report SIZED, a Spliterator for a Set would report DISTINCT, and a Spliterator for a SortedSet would also report SORTED.
We will see its syntax and how Spliterator can be instantiated?
This has many useful methods and explanations for each method with example programs.