mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 02:21:17 +07:00
PR#2100 Co-authored-by: Tagir Valeev <tagir.valeev@jetbrains.com> GitOrigin-RevId: c0b8495f26bccf51c593deb6be927eb01c37d379
14 lines
469 B
Java
14 lines
469 B
Java
// "Replace Optional presence condition with functional style expression" "GENERIC_ERROR_OR_WARNING"
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.Optional;
|
|
import java.util.function.Function;
|
|
import java.util.function.Supplier;
|
|
|
|
public class Main {
|
|
|
|
public void test(Optional<String> opt, Function<String, @NotNull Object> onPresent, Supplier<Object> onEmpty) {
|
|
Object o = opt.i<caret>sPresent() ? onPresent.apply(opt.get()) : onEmpty.get();
|
|
}
|
|
} |