mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-21 15:35:34 +07:00
14 lines
313 B
Java
14 lines
313 B
Java
// "Simplify optional chain to '!...isPresent()'" "true"
|
|
import java.util.Optional;
|
|
|
|
public class Test {
|
|
interface Dto {
|
|
int getId();
|
|
}
|
|
|
|
public void test(Dto dto) {
|
|
boolean present = Optional.ofNullable(dto).map(Dto::getId).map(obj -> {
|
|
return false;
|
|
}).or<caret>ElseGet(() -> true);
|
|
}
|
|
} |