Iterable to Stream in Java

Iterable to Stream in Java

In this post, we will learn to convert Iterable to Stream in Java.

To convert Iterable to Stream, we need to follow the steps below:

  • Convert Iterable to Spliterator and
  • Call the static method stream() from StreamSupport class.

Assume that we have an iterator object like:

Iterable<String> iterable = Arrays.asList("Radha", "Krishnan", "Coder", "Sathi");

Now, convert this iterable object to stream:

Stream<String> stream =, false);

In this way, we can easily convert iterable to stream in Java.

Notify of
Inline Feedbacks
View all comments