mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 18:58:31 +07:00
18 lines
390 B
Java
18 lines
390 B
Java
// "Replace with collect" "true"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Collect {
|
|
class Person {
|
|
String getName() {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
void collectNames(List<Person> persons){
|
|
Set<String> names, other = new HashSet<>();
|
|
names = persons.stream().map(Person::getName).collect(Collectors.toSet());
|
|
System.out.println(names);
|
|
}
|
|
}
|