Interface Multi<T>

    • Method Detail

      • map

        default <U> Multi<U> map​(Mapper<T,​U> mapper)
        Map this Multi instance to a new Multi of another type using the given Mapper.
        Type Parameters:
        U - mapped item type
        Parameters:
        mapper - mapper
        Returns:
        Multi
        Throws:
        NullPointerException - if mapper is null
      • peek

        default Multi<T> peek​(Consumer<T> consumer)
        Invoke provided consumer for every item in stream.
        Parameters:
        consumer - consumer to be invoked
        Returns:
        Multi
      • distinct

        default Multi<T> distinct()
        Filter out all duplicates.
        Returns:
        Multi
      • filter

        default Multi<T> filter​(Predicate<T> predicate)
        Filter stream items with provided predicate.
        Parameters:
        predicate - predicate to filter stream with
        Returns:
        Multi
      • takeWhile

        default Multi<T> takeWhile​(Predicate<T> predicate)
        Take the longest prefix of elements from this stream that satisfy the given predicate. As long as predicate returns true, items from upstream are sent to downstream, when predicate returns false stream is completed.
        Parameters:
        predicate - predicate to filter stream with
        Returns:
        Multi
      • dropWhile

        default Multi<T> dropWhile​(Predicate<T> predicate)
        Drop the longest prefix of elements from this stream that satisfy the given predicate. As long as predicate returns true, items from upstream are NOT sent to downstream but being dropped, predicate is never called again after it returns false for the first time.
        Parameters:
        predicate - predicate to filter stream with
        Returns:
        Multi
      • limit

        default Multi<T> limit​(long limit)
        Limit stream to allow only specified number of items to pass.
        Parameters:
        limit - with expected number of items to be produced
        Returns:
        Multi
      • skip

        default Multi<T> skip​(long skip)
        Skip first n items, all the others are emitted.
        Parameters:
        skip - number of items to be skipped
        Returns:
        Multi
      • flatMapIterable

        default Multi<T> flatMapIterable​(Function<T,​Iterable<T>> iterableMapper)
        Transform item with supplied function and flatten resulting Iterable to downstream.
        Parameters:
        iterableMapper - Function receiving item as parameter and returning Iterable
        Returns:
        Multi
      • forEach

        default void forEach​(Consumer<T> consumer)
        Terminal stage, invokes provided consumer for every item in the stream.
        Parameters:
        consumer - consumer to be invoked for each item
      • collectList

        default Single<List<T>> collectList()
        Collect the items of this Multi instance into a Single of List.
        Returns:
        Single
      • collect

        default <U> Single<U> collect​(Collector<T,​U> collector)
        Collect the items of this Multi instance into a Single.
        Type Parameters:
        U - collector container type
        Parameters:
        collector - collector to use
        Returns:
        Single
        Throws:
        NullPointerException - if collector is null
      • first

        default Single<T> first()
        Get the first item of this Multi instance as a Single.
        Returns:
        Single
      • from

        static <T> Multi<T> from​(Flow.Publisher<T> source)
        Create a Multi instance wrapped around the given publisher.
        Type Parameters:
        T - item type
        Parameters:
        source - source publisher
        Returns:
        Multi
        Throws:
        NullPointerException - if source is null
      • from

        static <T> Multi<T> from​(Iterable<T> iterable)
        Create a Multi instance that publishes the given iterable.
        Type Parameters:
        T - item type
        Parameters:
        iterable - iterable to publish
        Returns:
        Multi
        Throws:
        NullPointerException - if iterable is null
      • just

        static <T> Multi<T> just​(Collection<T> items)
        Create a Multi instance that publishes the given items to a single subscriber.
        Type Parameters:
        T - item type
        Parameters:
        items - items to publish
        Returns:
        Multi
        Throws:
        NullPointerException - if items is null
      • just

        @SafeVarargs
        static <T> Multi<T> just​(T... items)
        Create a Multi instance that publishes the given items to a single subscriber.
        Type Parameters:
        T - item type
        Parameters:
        items - items to publish
        Returns:
        Multi
        Throws:
        NullPointerException - if items is null
      • empty

        static <T> Multi<T> empty()
        Get a Multi instance that completes immediately.
        Type Parameters:
        T - item type
        Returns:
        Multi
      • never

        static <T> Multi<T> never()
        Get a Multi instance that never completes.
        Type Parameters:
        T - item type
        Returns:
        Multi
      • concat

        static <T> Multi<T> concat​(Multi<T> firstMulti,
                                   Multi<T> secondMulti)
        Concat streams to one.
        Type Parameters:
        T - item type
        Parameters:
        firstMulti - first stream
        secondMulti - second stream
        Returns:
        Multi