Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/beforeMethodReferences.java
Tagir Valeev eda6bb3c28 FunctionHelper#registerReusedElements: pass qualifier only
Because ::xyz part is not actually reused, comments from there are not preserved.
2018-11-08 17:30:50 +07:00

24 lines
677 B
Java

// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class Main {
private static void test(List<String> names) {
names.stream().filter(Objects::nonNull).fo<caret>rEach(System/*1*/./*2*/out/*3*/::/*4*/println);
}
private static String getString() {
return "abc";
}
private static boolean testBound(List<String> strings) {
return strings.stream().anyMatch(getString()::equals);
}
public static void main(String[] args) {
test(Arrays.asList("a", "b", "xyz"));
System.out.println(testBound(Arrays.asList("a", "b", "c")));
}
}