Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstRunnableTernary.java
Tagir Valeev 7e574d661c IDEA-163764 "Replace Optional.isPresent() checks with functional-style expressions" create uncompilable code
IDEA-163463 Stream API migration: type argument before map appears sometimes when it's unnecessary
2016-11-11 11:28:44 +07:00

10 lines
316 B
Java

// "Replace with findFirst()" "true"
import java.util.*;
public class Main {
public Runnable getRunnable(List<String> data) {
Runnable def = () -> {};
return data.stream().filter(s -> s.startsWith("xyz")).findFirst().<Runnable>map(s -> s.length() > 2 ? s::trim : System.out::println).orElse(def);
}
}