Object[] (List<String> data) { List<String> result = new ArrayList<>(); for (String str : d<caret>ata) { if (!str.isEmpty()) result.add(str); } Object[] arr = result.toArray(); System.out.println(result); return arr; }