mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
OptionalToIfInspection: misc fixes
1. generate if with curly braces when it contains single declaration inside 2. restore else branch after generating code for flatMap 3. do not reassign source variable for nested source operations GitOrigin-RevId: 061fbcc8d8dda586dcecb9a448752709a43370da
This commit is contained in:
committed by
intellij-monorepo-bot
parent
05017ec31f
commit
f0c78aea15
+12
@@ -32,6 +32,18 @@ class Test {
|
||||
String out = Optional.ofNullable(in).flatMap(s1 -> Optional.of(p)).orElse("bar");
|
||||
}
|
||||
|
||||
void nestedFlatMap(String var0) {
|
||||
boolean b = Optional.ofNullable(var0)
|
||||
.flatMap(var1 ->
|
||||
Optional.of(var1).map(s -> s.toLowerCase())
|
||||
.flatMap(var2 -> Optional.ofNullable(var2)))
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
String flatMapWithOrInside() {
|
||||
return Optional.<String>empty().flatMap(s1 -> Optional.empty().or(() -> Optional.empty())).get();
|
||||
}
|
||||
|
||||
<T> T id(T t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user