OptionalDouble orElse(double) method in Java with examples
The orElse(double) method helps us to get the value in this OptionalDouble object. If a value is not present in this OptionalDouble, then this method returns the value passed as the parameter.
public double orElse(double other)
Parameters: This method accepts double the value to be returned, if no value is present.
Return value: This method returns the value, if present, otherwise other.
Below programs illustrate toString() 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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.