IDEA-211702 Incorrect inspection "Can be replaced with single expression in functional style" when types differ

GitOrigin-RevId: 4006edb212486fa38b31b26ecbed881e6079f6e6
This commit is contained in:
Tagir Valeev
2019-04-29 13:28:39 +03:00
committed by intellij-monorepo-bot
parent 3ddbffb2db
commit 61ac76cf48
2 changed files with 24 additions and 4 deletions
@@ -0,0 +1,14 @@
// "Replace Optional.isPresent() condition with functional style expression" "false"
import java.util.Optional;
class Test {
Object get() {
Optional<String> obj = Stream.of("one", "two").filter(s -> Math.sqrt(s.length()) > 100).findFirst();
if (obj.<caret>isPresent()) {
return obj.get();
} else {
return 7;
}
}
}