• b84
    • Verified

      Optional<T> acts as a container for zero or one non-null values of type T. For methods which may return a value or not (e.g., stream.findFirst()), returning an Optional<T> is more explicit and type-safe. Optional has methods like get() (throws if the value is not present), orElse(T alternate), orElseThrow(Factory<Throwable>), etc.

            mduigou Mike Duigou
            briangoetz Brian Goetz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: