Java tutorial
import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Set<Integer> numberSet = new HashSet<Integer>() { { add(1); add(2); add(3); } }; Stream<Integer> collectionStream = numberSet.stream(); System.out.println(Arrays.toString(collectionStream.toArray())); } }