### Question:
Optionals { public static <T> Stream<T> stream(Optional<T> optional) { return optional.map(Stream::of) .orElseGet(Stream::empty); }  static Optional<Collection<T>> of(Collection<T> collection); static Stream<T> stream(Optional<T> optional);  }### Answer:
@Test public void testStream() { assertThat(Optionals.stream(Optional.of("foo")).count()).isEqualTo(1L); assertThat(Optionals.stream(Optional.of("foo")).findFirst()).hasValue("foo"); }
@Test public void testEmptyStream() { assertThat(Optionals.stream(Optional.empty()).count()).isEqualTo(0L); }