Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/collect/afterCollectHashSetFieldInitializer.java

16 lines
304 B
Java

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