mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
17 lines
373 B
Java
17 lines
373 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Collect {
|
|
class Person {
|
|
String getName() {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
void collectNames(List<Person> persons){
|
|
Set<String> names = persons.stream().map(Person::getName).collect(Collectors.toSet());
|
|
/*valuable comment*/
|
|
}
|
|
}
|