Class MultiGroupIntoLists<T>


  • public class MultiGroupIntoLists<T>
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Multi<java.util.List<T>> every​(java.time.Duration duration)
      Creates a Multi that emits lists of items collected from the observed Multi.
      Multi<java.util.List<T>> of​(int size)
      Creates a Multi that emits lists of items collected from the observed Multi.
      Multi<java.util.List<T>> of​(int size, int skip)
      Creates a Multi that emits lists of items collected from the observed Multi.
      Multi<java.util.List<T>> of​(int size, java.time.Duration maximumDelay)
      Creates a Multi that emits lists of items collected from the observed Multi.
      • Methods inherited from class java.lang.Object

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

      • MultiGroupIntoLists

        public MultiGroupIntoLists​(Multi<T> upstream)
    • Method Detail

      • every

        @CheckReturnValue
        public Multi<java.util.List<T>> every​(java.time.Duration duration)
        Creates a Multi that emits lists of items collected from the observed Multi.

        The resulting Multi emits connected, non-overlapping lists, each of a fixed duration specified by the duration parameter. If, during the configured time window, no items are emitted by the upstream Multi, an empty list is emitted by the returned Multi.

        When the upstream Multi sends the completion event, the resulting Multi emits the current list and propagates the completion event.

        If the upstream Multi sends a failure, the failure is propagated immediately.

        Parameters:
        duration - the period of time each list collects items before it is emitted and replaced with a new list. Must be non null and positive.
        Returns:
        a Multi that emits every duration with the items emitted by the upstream multi during the time window.
      • of

        @CheckReturnValue
        public Multi<java.util.List<T>> of​(int size)
        Creates a Multi that emits lists of items collected from the observed Multi.

        The resulting Multi emits lists every size items.

        When the upstream Multi sends the completion event, the produced Multi emits the current list, and sends the completion event. This last list may not contain size items. If the upstream Multi sends the completion event before having emitted any event, the completion event is propagated immediately.

        If the upstream Multi sends a failure, the failure is propagated immediately.

        Parameters:
        size - the size of each collected list, must be positive
        Returns:
        a Multi emitting lists of at most size items from the upstream Multi.
      • of

        @CheckReturnValue
        public Multi<java.util.List<T>> of​(int size,
                                           int skip)
        Creates a Multi that emits lists of items collected from the observed Multi.

        The resulting Multi emits lists every skip items, each containing size items.

        When the upstream Multi sends the completion event, the produced Multi emits the current list, and sends the completion event. This last list may not contain size items. If the upstream Multi * sends the completion event before having emitted any event, the completion event is propagated immediately.

        If the upstream Multi sends a failure, the failure is propagated immediately.

        Parameters:
        size - the size of each collected list, must be positive and non-0
        skip - the number of items skipped before starting a new list. If skip and size are equal, this operation is similar to of(int). Must be positive and non-0
        Returns:
        a Multi emitting lists for every skip items from the upstream Multi. Each list contains at most size items
      • of

        @CheckReturnValue
        public Multi<java.util.List<T>> of​(int size,
                                           java.time.Duration maximumDelay)
        Creates a Multi that emits lists of items collected from the observed Multi.

        The resulting Multi emits lists every maximumDelay duration and splits them into lists of size items. Therefore, the list may not always contain size items but it is guaranteed to emit a list every maximumDelay duration, if at least one element was emitted by the upstream.

        When the upstream Multi sends the completion event, the produced Multi emits the current list, and sends the completion event. This last list may also not contain size items. If the upstream Multi sends the completion event before having emitted any event, the completion event is propagated immediately.

        If the upstream Multi sends a failure, the failure is propagated immediately.

        Parameters:
        size - the maximum size of each collected list, must be positive
        maximumDelay - the maximum delay between the upstream emitting an item and a list being emitted by the returned Multi.
        Returns:
        a Multi emitting lists of at most size items from the upstream Multi.