mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-20 11:36:16 +07:00
8 lines
267 B
Java
8 lines
267 B
Java
// "Simplify optional chain to '(String)...orElse(...)'" "true"
|
|
import java.util.Optional;
|
|
|
|
public class Test {
|
|
public void test(Optional<Object> opt) {
|
|
String result = opt.filter(opt -> opt instanceof String).map(opt -> (String) opt).or<caret>Else(null);
|
|
}
|
|
} |