How to avoid/handle more clear and safer NullPointerException
in java-8 ?
But other than Optional
class:
Optional emptyOptional = Optional.empty();
emptyOptional.ifPresent(System.out::println);
if (emptyOptional.isPresent())
System.out.println(emptyOptional.get());
is there other way in java-8
?