Class StreamUtils


  • public final class StreamUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​S>
      java.util.stream.Stream<S>
      filterNullAndMap​(java.util.stream.Stream<T> elements, java.util.function.Function<T,​S> mapper)
      Applies the supplied mapper function on every non-null element in the supplied Stream of elements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • filterNullAndMap

        @Nonnull
        public static <T,​S> java.util.stream.Stream<S> filterNullAndMap​(@Nonnull
                                                                              java.util.stream.Stream<T> elements,
                                                                              @Nonnull
                                                                              java.util.function.Function<T,​S> mapper)
        Applies the supplied mapper function on every non-null element in the supplied Stream of elements.
        Type Parameters:
        T - the type of the elements in the stream.
        S - the resulting type after applying the mapper function on an element.
        Parameters:
        elements - the stream of elements.
        mapper - the mapper function to apply on every element.
        Returns:
        a stream of the resulting mapped elements.