The of(double) method help us to get an OptionalDouble object which contains a double value which is passed as a parameter to this method.
public static OptionalDouble of(double value)
Parameters: This method accepts a double value as parameter that will be set to the returned OptionalDouble object.
Return value: This method returns an OptionalDouble with the value present.
Below programs illustrate of(double) 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.