List<String> (String[] args) { List<String> result = new ArrayList<>(); for (String arg : args) { if (arg != null) { result.add(arg); } } List<String> list = Collections.unmodifiableList(result); return list; }