// "Replace with collect" "true" import java.util.ArrayList; import java.util.List; public class Main { public List test(List list) { List result = new ArrayList<>(); for(String s : list) { Runnable r = () -> { String str = s; if (str.isEmpty()) str = "none"; System.out.println(str); }; result.add(r); } return result; } }