// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true" import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main { void sample(List people) { List list1 = people.stream().collect( // comment Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList)); } void sample1(List people) { List listIdentity = people.stream().collect( // comment Collectors.collectingAndThen(Collectors.toList(), Function.identity())); } void sample2(List people) { Map map = people.stream().collect( // comment Collectors.collectingAndThen(Collectors.toMap(String::length, Function.identity()), Collections::unmodifiableMap)); } void sample3(List people) { List list2 = people.stream().collect( // comment Collectors.collectingAndThen(Collectors.>toCollection(LinkedList::new), list -> Stream.concat(list.stream(), list.stream()).collect(Collectors.toList()))); } }