java.util.Optional
ImagineOptionalas a container that may or may not contain some value. Just like all references in Java can point to some object or be null,Optionmay enclose some (non-null!) reference or be empty.
Optional instead of plain null is statically checked at compile time and much more informative as it clearly indicates that a given variable may be present or not. Of course it requires some discipline - you should never assign null to any variable any more.
