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