public class MultiCollect<T> extends Object
| Constructor and Description |
|---|
MultiCollect(Multi<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
Uni<List<T>> |
asList()
|
<K> Uni<Map<K,T>> |
asMap(Function<? super T,? extends K> keyMapper)
|
<K,V> Uni<Map<K,V>> |
asMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper)
|
<K> Uni<Map<K,Collection<T>>> |
asMultiMap(Function<? super T,? extends K> keyMapper)
|
<K,V> Uni<Map<K,Collection<V>>> |
asMultiMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper)
|
Uni<T> |
first()
|
<X> Uni<X> |
in(Supplier<X> supplier,
BiConsumer<X,T> accumulator)
|
Uni<T> |
last()
|
<X,A> Uni<X> |
with(Collector<? super T,A,? extends X> collector)
|
public Uni<T> first()
Uni receiving the first item emitted by the upstream Multi.
If the Multi is empty, the produced Uni fires null as item when the Multi
emits the completion event. If the Multi emits a failure before having emitted an item, the produced
Uni propagates the failure.public Uni<T> last()
Uni receiving the last item emitted by the upstream Multi.
The last item is item fired just before the completion event.
If the Multi is empty, the produced Uni fires null as item when the Multi
emits the completion event. If the Multi emits a failure, the produced Uni propagates the
failure.
public <X> Uni<X> in(Supplier<X> supplier, BiConsumer<X,T> accumulator)
Uni emitting a container with all items emitted by this Multi.
It produces the container instance using the passed Supplier (at subscription time) and then call the
accumulator bi-consumer for each item emitted by the Multi.
The collected item will be emitted when this Multi fires the completion event.
If the Multi propagates a failure, the produces Uni propagates the same failure, even if some
items have been collected.
If the Multi is empty, the supplied container is returned empty
X - the type of the container produced by the supplier.supplier - the supplier of the container instance, called at Subscription time. Must not be null.
Must not produce nullaccumulator - a consumer called on every item with the container instance and the item. It should
add the item into the container. Must not be nullUni emitting the collected container as item when this Multi completespublic <K> Uni<Map<K,T>> asMap(Function<? super T,? extends K> keyMapper)
Uni emitting a Map of key -> item for each item emitted by this
Multi. The collected map is emitted by the produced Uni when the Multi fires the
completion event.
The key is extracted from each item by applying the keyMapper function. In case of conflict,
the associated value will be the most recently emitted item.
K - the type of the key extracted from each item emitted by this MultikeyMapper - a Function to map item to a key for the Map. Must not be null,
must not produce nullUni emitting an item with the collected Map. The uni emits the item when this
Multi completespublic <K,V> Uni<Map<K,V>> asMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
Uni emitting a Map of key -> mapped item for each item emitted by
this Multi. The collected map is emitted by the produced Uni when the Multi fires the
completion event.
The key is extracted from each item by applying the keyMapper function. In case of conflict,
the associated value will be the most recently emitted item. The value is computed by applying the
valueMapper function.
K - the type of the key extracted from each item emitted by this MultiV - the type of the value extracted from each item emitted by this MultikeyMapper - a Function to map item to a key for the Map. Must not be null,
must not produce nullvalueMapper - a Function to map item to a value for the Map. Must not be null,
must not produce nullUni emitting an item with the collected Map. The uni emits the item when this
Multi completespublic <K,V> Uni<Map<K,Collection<V>>> asMultiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
Uni emitting a Map of key -> Collection of mapped values for each
item emitted by this Multi. The collected map is emitted by the produced Uni when the
Multi fires the completion event.
The key is extracted from each item by applying the keyMapper function.
The value is a collection containing all the values mapped to the specific key. The value is computed
by applying the valueMapper function.
K - the type of the key extracted from each item emitted by this MultiV - the type of the value extracted from each item emitted by this MultikeyMapper - a Function to map item to a key for the Map. Must not be null,
must not produce nullvalueMapper - a Function to map item to a value for the Map. Must not be null,
must not produce nullUni emitting an item with the collected Map. The uni emits the item when this
Multi completespublic <K> Uni<Map<K,Collection<T>>> asMultiMap(Function<? super T,? extends K> keyMapper)
Uni emitting a Map of key -> Collection of items for each
item emitted by this Multi. The collected map is emitted by the produced Uni when the
Multi fires the completion event.
The key is extracted from each item by applying the keyMapper function.
The value is a collection containing all the items emitted associated to the specific key.
K - the type of the key extracted from each item emitted by this MultikeyMapper - a Function to map item to a key for the Map.Must not be null,
must not produce nullUni emitting an item with the collected Map. The uni emits the item when this
Multi completesCopyright © 2019–2020 SmallRye. All rights reserved.