javautilOptional
java.util.Optional is a container object in the Java standard library that may or may not contain a non-null value. Introduced in Java 8, it is designed to express the presence or absence of a value explicitly, helping to reduce null-related errors and encourage deliberate handling of missing data. Optional is not a collection; it is a wrapper around a value that may be empty.
Key features and API basics include the static factories Optional.empty() and Optional.ofNullable(T value) (and Optional.of(T value)
Common usage patterns include wrapping potentially null results with Optional.ofNullable, supplying defaults with orElse or orElseGet,