Spliterator stands for Splitable Iterator. It is newly introduced by Oracle Corporation as part Java SE 8.
Like Iterator and ListIterator, It is also one of the Iterator interface.
SPLITERATOR
- It is introduced in Java SE 8.
- Splitable Iterator
- It is used in Stream API.
- It uses Internal Iteration concept to iterate Streams.
- We can use Spliterator to iterate Streams in Parallel and Sequential
order.
- We can get Spliterator by calling spliterator() method on Stream
Object.
ITERATOR
- It is available since Java 1.2.
- It is used for Collection API.
- Non-Splitable Iterator
- It uses External Iteration concept to iterate Collections.
- We can use Iterator to iterate Collections only in Sequential order.
- We can get Iterator by calling iterator() method on Collection
Object.