OptionalDouble (Java SE 25 & JDK 25)
-
Method Summary
empty()Returns an empty
OptionalDoubleinstance.booleanIndicates whether some other object is "equal to" this
OptionalDouble.doubleIf a value is present, returns the value, otherwise throws
NoSuchElementException.inthashCode()Returns the hash code of the value, if present, otherwise
0(zero) if no value is present.voidIf a value is present, performs the given action with the value, otherwise does nothing.
voidIf a value is present, performs the given action with the value, otherwise performs the given empty-based action.
booleanisEmpty()If a value is not present, returns
true, otherwisefalse.booleanIf a value is present, returns
true, otherwisefalse.of(double value) Returns an
OptionalDoubledescribing the given value.doubleorElse(double other) If a value is present, returns the value, otherwise returns
other.doubleIf a value is present, returns the value, otherwise returns the result produced by the supplying function.
doubleIf a value is present, returns the value, otherwise throws
NoSuchElementException.orElseThrow(Supplier<? extends X> exceptionSupplier) If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.
stream()If a value is present, returns a sequential
DoubleStreamcontaining only that value, otherwise returns an emptyDoubleStream.toString()Returns a non-empty string representation of this
OptionalDoublesuitable for debugging.
-
Method Details
-
empty
-
of
-
getAsDouble
-
isPresent
-
isEmpty
-
ifPresent
-
ifPresentOrElse
-
stream
-
orElse
-
orElseGet
-
orElseThrow
-
orElseThrow
-
equals
-
hashCode
-
toString
-