void () { doTest( """ import java.util.stream.*; import java.util.*; class Test { void test() { Stream.of("a", "b", "c")./*Result of 'Stream.collect()' is ignored*/collect/**/(Collectors.toSet()); Stream.of("a", "b", "c")./*Result of 'Stream.collect()' is ignored*/collect/**/(Collectors.toCollection(() -> new ArrayList<>())); Set<String> result = new TreeSet<>(); result.add("-"); // violates stream principles, but quite widely used (IDEA-164501); // this inspection should not warn here; probably some other inspection should suggest better option\s Stream.of("a", "b", "c").collect(Collectors.toCollection(() -> result)); } }"""); }