我在Java 8下面有代码快照.
List<Employee> employees = DataProvider.getEmployees();
Set<Employee> set = employees.stream().filter(emp -> {
System.out.println(emp.getName());
return emp.getName().equals("Vishal");
}).collect(Collectors.toSet());
Run Code Online (Sandbox Code Playgroud)
我只是想知道Set它在使用时使用默认的哪个实现Collectors.toSet()(参见上面的例子)?
另外,有没有办法表明java API使用特定的实现(例如HashSet)?