// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true" package java.util.stream; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; class Collectors { public static native Collector> toUnmodifiableList(); public static native Collector> toUnmodifiableSet(); public static native Collector> toUnmodifiableMap(Function keyMapper, Function valueMapper); } class MyFile { public static List testList(String[] args) { List result = new ArrayList<>(); for (String arg : args) { if (arg != null) { result.add(arg); } } List list = Collections.unmodifiableList(result); return list; } public static Set testSet(String[] args) { Set set = new HashSet<>(); for (String arg : args) { if (arg != null) { set.add(arg); } } return Collections.unmodifiableSet(set); } public static Map testMap(String[] args) { Map map = new HashMap<>(); for (String arg : args) { if (arg != null) { if (map.put(arg.trim(), arg) != null) { throw new IllegalStateException("Duplicate key"); } } } return Collections.unmodifiableMap(map); } }