mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
20 lines
450 B
Java
20 lines
450 B
Java
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
|
|
|
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();
|
|
}
|
|
}
|
|
} |