Reducing NullPointerExceptions with Java Optional posted on November 24, 2020hotel = Optional.of(sheraton);\nif (hotel.isPresent()) {\n hotel.get().getAmenities();\n}\n\nOptional emptyHotel = Optional.empty();\nif (hotel.isPresent()) {\n // never …Continue Reading about Reducing NullPointerExceptions with Java Optional →