package yokohama.unit.util;

import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;

public class Optionals {
    public static <T, U> U match(Optional<T> optional, Supplier<U> none, Function<? super T, U> some) {
        return optional.isPresent() ? some.apply(optional.get()) : none.get();
    }
}

@@ -125,16 +125,49 @@
 pplier;%0D
+%0Aimport java.util.stream.Stream;%0D
 %0A%0D%0Apubli
@@ -378,12 +378,170 @@
 %0D%0A    %7D%0D
+%0A%0D%0A    public static %3CT%3E Stream%3CT%3E toStream(Optional%3CT%3E optional) %7B%0D%0A        return optional.isPresent() ? Stream.of(optional.get()) : Stream.empty();%0D%0A    %7D%0D
 %0A%7D%0D%0A

Add toStream method to Optionals class