Class BambooOptionals


  • public final class BambooOptionals
    extends Object
    • Method Detail

      • stream

        public static <T> Stream<T> stream​(Optional<T> o)
        Converts the given Optional to a Stream
      • get

        public static <T> T get​(Optional<T> o,
                                String errorMessage)
        Retrieves the optional content. If it's not present throws ISE with the supplied error mesage.
      • withPresent

        public static <T> void withPresent​(Optional<T> o,
                                           Consumer<? super T> consumer,
                                           String errorMessage)
        Applies the consumer to the optional value. If the value is not present throws ISE with the supplied error message.