@Beta
  public static IntStream stream(OptionalInt optional) {
    return optional.isPresent() ? IntStream.of(optional.getAsInt()) : IntStream.empty();
  }
@Beta
  public static IntStream stream(OptionalInt optional) {
    return optional.isPresent() ? IntStream.of(optional.getAsInt()) : IntStream.empty();
  }
@ Beta public static IntStream stream ( OptionalInt optional ) { return optional . isPresent ( ) ? IntStream . of ( optional . getAsInt ( ) ) : IntStream . empty ( ) ; }
If a value is present in {@code optional}, returns a stream containing only that element,
otherwise returns an empty stream.

<p><b>Java 9 users:</b> use {@code optional.stream()} instead.
If a value is present in { @code optional } returns a stream containing only that element otherwise returns an empty stream .