top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Spliterator in Java SE 8? Differences between Iterator and Spliterator in Java SE 8?

0 votes
520 views
What is Spliterator in Java SE 8? Differences between Iterator and Spliterator in Java SE 8?
posted Dec 1, 2017 by Jon Deck

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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

  1. It is introduced in Java SE 8.
  2. Splitable Iterator
  3. It is used in Stream API.
  4. It uses Internal Iteration concept to iterate Streams.
  5. We can use Spliterator to iterate Streams in Parallel and Sequential
    order.
  6. We can get Spliterator by calling spliterator() method on Stream
    Object.

ITERATOR

  1. It is available since Java 1.2.
  2. It is used for Collection API.
  3. Non-Splitable Iterator
  4. It uses External Iteration concept to iterate Collections.
  5. We can use Iterator to iterate Collections only in Sequential order.
  6. We can get Iterator by calling iterator() method on Collection
    Object.
answer Dec 3, 2017 by Frank Lee
...