mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
18 lines
425 B
Java
18 lines
425 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);
|
|
optPower.ifPresent(value -> power = value);
|
|
}
|
|
} |