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