Java Stream create from Set
import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Set<String> names = new HashSet<>(); names.add("XML"); names.add("Java"); names.add("SQL"); names.add("Javascript"); names.add("CSS"); names.add("HTML"); Stream<String> sequentialStream = names.stream(); sequentialStream.forEach(System.out::println); Stream<String> parallelStream = names.parallelStream(); parallelStream.forEach(System.out::println); }/*w ww . j a v a2 s. c o m*/ }