mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-163767: fixed for assignment, tests for assignment and ternary
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main<T> {
|
||||
Optional<Object> foo(Optional<Object> first) {
|
||||
Optional<Object> o;
|
||||
o = first;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main<T> {
|
||||
Optional<Object> foo(Optional<Object> first) {
|
||||
Optional<Object> o = first;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main<T> {
|
||||
Optional<Object> foo(Optional<Object> first) {
|
||||
Optional<Object> o;
|
||||
if (first.isPrese<caret>nt())
|
||||
o = first;
|
||||
else
|
||||
o = Optional.empty();
|
||||
return o;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main<T> {
|
||||
Optional<Object> foo(Optional<Object> first) {
|
||||
Optional<Object> o = !first.isPrese<caret>nt() ? Optional.empty() : first;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user