0 votes
in JAVA by
What is Optional in Java 8?

1 Answer

0 votes
by

Optional is a container object which is used to contain not-null objects. An optional object is used to represent null with an absent value. 

The Optional class has various utility methods to facilitate code to handle values as 'available' or 'not available' instead of checking null values. 

The purpose of the Optional class is to provide a type-level solution for representing optional values instead of using null references.

Related questions

0 votes
asked Apr 26 in JAVA by SakshiSharma
0 votes
asked Feb 27, 2023 in JAVA by Robindeniel
...