Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectHashSetFieldInitializer.java
2016-09-13 11:35:14 +07:00

16 lines
305 B
Java

// "Replace with forEach" "true"
import java.util.*;
public class Collect {
class Person {
String getName() {
return "";
}
}
Set<String> names = new HashSet<>();
void collectNames(List<Person> persons){
persons.stream().map(Person::getName).forEach(s -> names.add(s));
}
}