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