I have below code snap with Java 8.
List employees = DataProvider.getEmployees(); Set set = employees.stream().filter(
The toSet() collector does not specify which implementation it uses; you get a Set, that's all.
toSet()
Set
If you want a specific kind of set, use toCollection() and provide a factory method for your set:
toCollection()
...collect(Collectors.toCollection(HashSet::new));