Package: java.util

## Class OptionalDouble

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `OptionalDouble` | `filter(DoublePredicate test)` If a value is present in the `OptionalDouble`, tests the value using the given predicate and returns the optional if the test returns true or empty otherwise.
    `double` | `get()` If a value is present in the `OptionalDouble`, returns the value, otherwise throws `NoSuchElementException`.
    `Optional` | `mapToObj(DoubleFunction mapper)` If a value is present in the `OptionalDouble`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.
    `DoubleStream` | `stream()` If a value is present in the OptionalDouble, returns a DoubleStream with the value as its source or else an empty stream.

  - #### Methods inherited from class java.lang.Object

    `addShutdownHook`, `any`, `any`, `asBoolean`, `asType`, `collect`, `collect`, `collect`, `dump`, `each`, `eachMatch`, `eachMatch`, `eachWithIndex`, `every`, `every`, `find`, `find`, `findAll`, `findAll`, `findIndexOf`, `findIndexOf`, `findIndexValues`, `findIndexValues`, `findLastIndexOf`, `findLastIndexOf`, `findResult`, `findResult`, `getAt`, `getMetaClass`, `getMetaPropertyValues`, `getProperties`, `grep`, `grep`, `hasProperty`, `identity`, `inject`, `inject`, `inspect`, `invokeMethod`, `is`, `isCase`, `isNotCase`, `iterator`, `metaClass`, `print`, `print`, `printf`, `printf`, `println`, `println`, `println`, `putAt`, `respondsTo`, `respondsTo`, `setMetaClass`, `split`, `sprintf`, `sprintf`, `stream`, `tap`, `toString`, `use`, `use`, `use`, `with`, `with`, `withCloseable`, `withStream`, `withTraits`

- - ### Methods Detail

    - #### public OptionalDouble filter(DoublePredicate test)

      If a value is present in the `OptionalDouble`, tests the value using the given predicate and returns the optional if the test returns true or empty otherwise.

          assert !OptionalDouble.empty().filter(n -> true).isPresent()
          assert  OptionalDouble.of(Math.PI).filter(n -> true).isPresent()
          assert !OptionalDouble.of(Math.PI).filter(n -> false).isPresent()
          assert  OptionalDouble.of(Math.PI).filter(n -> true).getAsDouble() == Math.PI

      Parameters:
      Since:
        3.0.0

    - #### public double get()

      If a value is present in the `OptionalDouble`, returns the value, otherwise throws `NoSuchElementException`.

          assert OptionalDouble.of(Math.PI).get() == Math.PI

      Since:
        3.0.0

    - #### public Optional mapToObj(DoubleFunction mapper)

      If a value is present in the `OptionalDouble`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.

          assert !OptionalDouble.empty().mapToObj(x -> new Object()).isPresent()
          assert  OptionalDouble.of(Math.PI).mapToObj(x -> new Object()).isPresent()
          assert !OptionalDouble.of(Math.PI).mapToObj(x -> null).isPresent()
          assert  OptionalDouble.of(Math.PI).mapToObj(Double::toString).get().startsWith('3.14')

      Parameters:
      Since:
        3.0.0

    - #### public DoubleStream stream()

      If a value is present in the OptionalDouble, returns a DoubleStream with the value as its source or else an empty stream.

      Since:
        3.0.0