Package io.helidon.common.reactive
Interface Multi<T>
-
- Type Parameters:
T
- item type
- All Superinterfaces:
Flow.Publisher<T>
,Subscribable<T>
public interface Multi<T> extends Subscribable<T>
Multiple items publisher facility.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default <U> Single<U>
collect(Collector<T,U> collector)
default Single<List<T>>
collectList()
static <T> Multi<T>
empty()
Get aMulti
instance that completes immediately.static <T> Multi<T>
error(Throwable error)
Create aMulti
instance that reports the given exception to its subscriber(s).default Single<T>
first()
static <T> Multi<T>
from(Flow.Publisher<T> source)
Create aMulti
instance wrapped around the given publisher.static <T> Multi<T>
just(Collection<T> items)
Create aMulti
instance that publishes the given items to a single subscriber.static <T> Multi<T>
just(T... items)
Create aMulti
instance that publishes the given items to a single subscriber.default <U> Multi<U>
map(Mapper<T,U> mapper)
static <T> Multi<T>
never()
Get aMulti
instance that never completes.-
Methods inherited from interface io.helidon.common.reactive.Flow.Publisher
subscribe
-
Methods inherited from interface io.helidon.common.reactive.Subscribable
subscribe, subscribe, subscribe, subscribe
-
-
-
-
Method Detail
-
map
default <U> Multi<U> map(Mapper<T,U> mapper)
- Type Parameters:
U
- mapped item type- Parameters:
mapper
- mapper- Returns:
- Multi
- Throws:
NullPointerException
- if mapper isnull
-
collect
default <U> Single<U> collect(Collector<T,U> collector)
- Type Parameters:
U
- collector container type- Parameters:
collector
- collector to use- Returns:
- Single
- Throws:
NullPointerException
- if collector isnull
-
from
static <T> Multi<T> from(Flow.Publisher<T> source)
Create aMulti
instance wrapped around the given publisher.- Type Parameters:
T
- item type- Parameters:
source
- source publisher- Returns:
- Multi
- Throws:
NullPointerException
- if source isnull
-
just
static <T> Multi<T> just(Collection<T> items)
Create aMulti
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 isnull
-
just
@SafeVarargs static <T> Multi<T> just(T... items)
Create aMulti
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 isnull
-
error
static <T> Multi<T> error(Throwable error)
Create aMulti
instance that reports the given exception to its subscriber(s). The exception is reported by invokingFlow.Subscriber.onError(java.lang.Throwable)
whenFlow.Publisher.subscribe(Subscriber)
is called.- Type Parameters:
T
- item type- Parameters:
error
- exception to hold- Returns:
- Multi
- Throws:
NullPointerException
- if error isnull
-
empty
static <T> Multi<T> empty()
Get aMulti
instance that completes immediately.- Type Parameters:
T
- item type- Returns:
- Multi
-
-