
Convert a java.util.List to java.util.Stream in Java 8
In my previous example I showed "How to convert Stream into a List in Java 8".In this example I will show how to convert a List into a Stream in Java 8.
Collections like the List can be easily obtained from a Java 8 Stream
by calling the stream() operation over a List.
This is a inbuilt feature and it helps in easy conversions from collections to Stream data.
List<String> itemList=Arrays.asList("List","to","Stream","Java8","Stream");
//Converting List to Stream in Java 8
Stream<String> itemStream=itemList.stream();
itemStream.distinct().forEach(x -> System.out.print(x+" "));
SEE ALSO: How to convert Stream into a List in Java 8

