mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-20 20:45:15 +07:00
12 lines
360 B
Java
12 lines
360 B
Java
// "Simplify optional chain to 'opt.filter(...).map(...).orElseGet(...)'" "true"
|
|
import java.util.Optional;
|
|
|
|
public class Test {
|
|
public String getDefaultValue() {
|
|
return "foo";
|
|
}
|
|
|
|
public void test(Optional<String> opt) {
|
|
String result = opt.map(obj -> obj.isEmpty() ? getDefaultValue() : obj.trim()).orEl<caret>seGet(this::getDefaultValue);
|
|
}
|
|
} |