Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/optionalIsPresent/beforeAssignmentMap.java
Tagir Valeev 21564bba7b IDEA-163627 Simplify optional.isPresent() inspection could better handle some specific cases
IDEA-163462 Simplify Optional.isPresent() ? Optional.get() : ...
2016-11-07 17:23:00 +07:00

18 lines
441 B
Java

// "Replace Optional.isPresent() condition with functional style expression" "true"
import java.util.*;
public class Main {
public void testOptional(Optional<String> str) {
String val;
if (str.isPrese<caret>nt()) {
val = // line comment
// another line comment
str.get()//before trim
.trim() /* block comment *//*block comment*/;
} else {
val = "";
}
System.out.println(val);
}
}