// "Collapse loop with stream 'toArray()'" "true-preview" import java.util.*; public class Main { public Integer[] testNestedAnyMatch(List> data) { return data.stream().filter(list -> list.stream().anyMatch(str -> !str.isEmpty())).map(List::size).toArray(Integer[]::new); } }