// "Replace with forEach" "true" import java.util.*; public class Collect { class Person { String getName() { return ""; } } void collectNames(List persons){ Set names = new HashSet<>(); for(int i=0; i<10; i++) { for (Person person : persons) { names.add(person.getName()); } } System.out.println(names); } }