mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-27 22:20:54 +07:00
PR#2100 Co-authored-by: Tagir Valeev <tagir.valeev@jetbrains.com> GitOrigin-RevId: c0b8495f26bccf51c593deb6be927eb01c37d379
20 lines
455 B
Java
20 lines
455 B
Java
// "Replace Optional presence condition with functional style expression" "true-preview"
|
|
|
|
import java.util.Optional;
|
|
|
|
public class Test {
|
|
private Power power;
|
|
|
|
interface Power {
|
|
static Optional<Power> parseValue(String value) {
|
|
return Optional.empty();
|
|
}
|
|
}
|
|
|
|
void testOpt(String powerValue) {
|
|
Optional<Power> optPower = Power.parseValue(powerValue);
|
|
if (optPower<caret>.isPresent()) {
|
|
power = optPower.get();
|
|
}
|
|
}
|
|
} |