@Test public void testOrElseGet() { assertThat(OptionalDouble.empty().orElseGet(new DoubleSupplier() { @Override public double getAsDouble() { return 21.098; } }), closeTo(21.098, 0.0001)); assertThat(OptionalDouble.of(21.098).orElseGet(new DoubleSupplier() { @Override public double getAsDouble() { throw new IllegalStateException(); } }), closeTo(21.098, 0.0001)); }
public double orElseGet(@NotNull DoubleSupplier other) { return isPresent ? value : other.getAsDouble(); }
OptionalDouble { public double orElseGet(@NotNull DoubleSupplier other) { return isPresent ? value : other.getAsDouble(); } }
OptionalDouble { public double orElseGet(@NotNull DoubleSupplier other) { return isPresent ? value : other.getAsDouble(); } private  OptionalDouble(); private  OptionalDouble(double value); }
OptionalDouble { public double orElseGet(@NotNull DoubleSupplier other) { return isPresent ? value : other.getAsDouble(); } private  OptionalDouble(); private  OptionalDouble(double value); @NotNull static OptionalDouble empty(); @NotNull static OptionalDouble of(double value); @NotNull static OptionalDouble ofNullable(@Nullable Double value); double getAsDouble(); boolean isPresent(); boolean isEmpty(); void ifPresent(@NotNull DoubleConsumer consumer); void ifPresentOrElse(@NotNull DoubleConsumer consumer, @NotNull Runnable emptyAction); @NotNull OptionalDouble executeIfPresent(@NotNull DoubleConsumer consumer); @NotNull OptionalDouble executeIfAbsent(@NotNull Runnable action); @Nullable R custom(@NotNull Function<OptionalDouble, R> function); @NotNull OptionalDouble filter(@NotNull DoublePredicate predicate); @NotNull OptionalDouble filterNot(@NotNull DoublePredicate predicate); @NotNull OptionalDouble map(@NotNull DoubleUnaryOperator mapper); @NotNull Optional<U> mapToObj(@NotNull DoubleFunction<U> mapper); @NotNull OptionalInt mapToInt(@NotNull DoubleToIntFunction mapper); @NotNull OptionalLong mapToLong(@NotNull DoubleToLongFunction mapper); @NotNull DoubleStream stream(); @NotNull OptionalDouble or(@NotNull Supplier<OptionalDouble> supplier); double orElse(double other); double orElseGet(@NotNull DoubleSupplier other); double orElseThrow(); double orElseThrow(@NotNull Supplier<X> exceptionSupplier); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString(); }
OptionalDouble { public double orElseGet(@NotNull DoubleSupplier other) { return isPresent ? value : other.getAsDouble(); } private  OptionalDouble(); private  OptionalDouble(double value); @NotNull static OptionalDouble empty(); @NotNull static OptionalDouble of(double value); @NotNull static OptionalDouble ofNullable(@Nullable Double value); double getAsDouble(); boolean isPresent(); boolean isEmpty(); void ifPresent(@NotNull DoubleConsumer consumer); void ifPresentOrElse(@NotNull DoubleConsumer consumer, @NotNull Runnable emptyAction); @NotNull OptionalDouble executeIfPresent(@NotNull DoubleConsumer consumer); @NotNull OptionalDouble executeIfAbsent(@NotNull Runnable action); @Nullable R custom(@NotNull Function<OptionalDouble, R> function); @NotNull OptionalDouble filter(@NotNull DoublePredicate predicate); @NotNull OptionalDouble filterNot(@NotNull DoublePredicate predicate); @NotNull OptionalDouble map(@NotNull DoubleUnaryOperator mapper); @NotNull Optional<U> mapToObj(@NotNull DoubleFunction<U> mapper); @NotNull OptionalInt mapToInt(@NotNull DoubleToIntFunction mapper); @NotNull OptionalLong mapToLong(@NotNull DoubleToLongFunction mapper); @NotNull DoubleStream stream(); @NotNull OptionalDouble or(@NotNull Supplier<OptionalDouble> supplier); double orElse(double other); double orElseGet(@NotNull DoubleSupplier other); double orElseThrow(); double orElseThrow(@NotNull Supplier<X> exceptionSupplier); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString();  }