Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/collect/afterCollectInterruptedUpdated.java
2022-12-23 13:26:29 +00:00

18 lines
379 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 = new HashSet<>();
names.add("Test");
persons.stream().map(Person::getName).forEach(names::add);
System.out.println(names);
}
}