mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
15 lines
303 B
Java
15 lines
303 B
Java
// "Collapse loop with stream 'forEach()'" "true-preview"
|
|
import java.util.*;
|
|
|
|
public class Collect {
|
|
class Person {
|
|
String getName() {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
void collectNames(List<Person> persons, Set<String> names){
|
|
persons.stream().map(Person::getName).forEach(names::add);
|
|
}
|
|
}
|