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