Class MultiGroup<T>

java.lang.Object
io.smallrye.mutiny.groups.MultiGroup<T>

public class MultiGroup<T> extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    MultiGroup(Multi<T> upstream)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    by(Function<? super T,? extends K> keyMapper)
    Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function.
    by(Function<? super T,? extends K> keyMapper, long prefetch)
    Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, with configurable prefetch buffer size.
    <K, V> Multi<GroupedMulti<K,V>>
    by(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
    Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, while transforming items using the valueMapper function.
    <K, V> Multi<GroupedMulti<K,V>>
    by(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, long prefetch)
    Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, while transforming items using the valueMapper function, with configurable prefetch buffer size.
    Splits the upstream Multi into List of items and emits these lists.
    Splits the upstream Multi into Multi of items and emits these Multi.

    Methods inherited from class java.lang.Object

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

    • MultiGroup

      public MultiGroup(Multi<T> upstream)
  • Method Details

    • intoLists

      @CheckReturnValue public MultiGroupIntoLists<T> intoLists()
      Splits the upstream Multi into List of items and emits these lists. The returned object configures how the split is made.
      Returns:
      the split configuration
    • intoMultis

      @CheckReturnValue public MultiGroupIntoMultis<T> intoMultis()
      Splits the upstream Multi into Multi of items and emits these Multi. It transforms the upstream Multi into a Multi<Multi<T>>, where each emitted multi contains items from the upstream.

      The returned object configures how the split is made.

      Returns:
      the split configuration
    • by

      @CheckReturnValue public <K> Multi<GroupedMulti<K,T>> by(Function<? super T,? extends K> keyMapper)
      Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function.

      The returned Multi<GroupedMulti<K, T>> emits GroupedMulti instances, where each represents a group of items sharing the same key. Items are distributed to groups as they are emitted by the upstream.

      Each GroupedMulti provides a GroupedMulti.key() method that returns the key for that group. Groups are created dynamically as new keys are discovered in the stream.

      Type Parameters:
      K - the type of the key
      Parameters:
      keyMapper - the function to extract the key from each item, must not be null
      Returns:
      a Multi emitting GroupedMulti instances
    • by

      @CheckReturnValue public <K, V> Multi<GroupedMulti<K,V>> by(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, while transforming items using the valueMapper function.

      The returned Multi<GroupedMulti<K, V>> emits GroupedMulti instances, where each represents a group of transformed items sharing the same key.

      Type Parameters:
      K - the type of the key
      V - the type of the transformed value
      Parameters:
      keyMapper - the function to extract the key from each item, must not be null
      valueMapper - the function to transform each item, must not be null
      Returns:
      a Multi emitting GroupedMulti instances
    • by

      @CheckReturnValue public <K> Multi<GroupedMulti<K,T>> by(Function<? super T,? extends K> keyMapper, long prefetch)
      Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, with configurable prefetch buffer size.

      The returned Multi<GroupedMulti<K, T>> emits GroupedMulti instances, where each represents a group of items sharing the same key. Items are distributed to groups as they are emitted by the upstream.

      The prefetch parameter controls how many items can be buffered for groups that are not yet subscribed to or are waiting for backpressure.

      Type Parameters:
      K - the type of the key
      Parameters:
      keyMapper - the function to extract the key from each item, must not be null
      prefetch - the prefetch buffer size, must be positive
      Returns:
      a Multi emitting GroupedMulti instances
    • by

      @CheckReturnValue public <K, V> Multi<GroupedMulti<K,V>> by(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, long prefetch)
      Groups items emitted by the upstream Multi based on a key extracted by the keyMapper function, while transforming items using the valueMapper function, with configurable prefetch buffer size.

      The returned Multi<GroupedMulti<K, V>> emits GroupedMulti instances, where each represents a group of transformed items sharing the same key.

      The prefetch parameter controls how many items can be buffered for groups that are not yet subscribed to or are waiting for backpressure.

      Type Parameters:
      K - the type of the key
      V - the type of the transformed value
      Parameters:
      keyMapper - the function to extract the key from each item, must not be null
      valueMapper - the function to transform each item, must not be null
      prefetch - the prefetch buffer size, must be positive
      Returns:
      a Multi emitting GroupedMulti instances