OptionalDouble
A container object which may or may not contain a non-null Double
value. If a value is present, isPresent()
will return true and get()
will return the value. Additional methods that depend on the presence or absence of a contained value are provided, such as orElse()
(return a default value if value not present) or orElseThrow
(throw an exception if a value is not present).
#
ofBuilds an OptionalDouble
.
#
isPresentReturns true
if a value is present.
Signature
Boolean isPresent()
#
getReturns the value when it is present. Throws a System.NoSuchElementException
when it is not.
Signature
Double get()
#
orElseReturns a value when it is present, or other
when it is not.
Signature
Double orElse(Double other)
#
orElseThrowReturns a value when it is present, or throws e
when it is not.
Signature
Double orElseThrow(Exception e)