// "Replace with toArray" "true" import java.util.*; public class Main { public Integer[] testNestedAnyMatch(List> data) { List result = new ArrayList<>(); for (List list : data) { for (String str : list) { if (!str.isEmpty()) { result.add(list.size()); break; } } } return result.toArray(new Integer[result.size()]); } }