IDEA-163767: fixed for assignment, tests for assignment and ternary

This commit is contained in:
Tagir Valeev
2016-11-11 13:24:09 +07:00
parent 1d74e0af9d
commit 0fa3853dfb
5 changed files with 46 additions and 1 deletions
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}