1
JavaIntermediate#streams
toList() collects stream elements into a List preserving encounter order and duplicates. toSet() collects into a Set, removing duplicates and with no guaranteed order (unless a specific Set supplier is used).
Stream.of(1,2,2,3).collect(Collectors.toList()); // [1,2,2,3] Stream.of(1,2,2,3).collect(Collectors.toSet()); // [1,2,3] order not guaranteed