1.

What are the advantages of using the Optional class?

Answer»

Below are the main advantage of using the Optional CLASS

It encapsulates optional values, i.e., null or not-null values, which helps in avoiding null checks, which results in better, READABLE, and robust code It acts as a WRAPPER around the object and RETURNS an object instead of a value, which can be used to avoid run-time NullPointerExceptions.



Discussion

No Comment Found