OptionalDouble help us to create an object which may or may not contain a Double value. The empty() method returns an empty OptionalDouble instance. No value is present for this OptionalDouble. So we can say that this method help us to create empty OptionalDouble object.
public static OptionalDouble empty()
Parameters: This method accepts nothing.
Return value: This method returns an empty OptionalDouble.
Below programs illustrate empty() method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.