public final class FlowableTransformers
extends java.lang.Object
FlowableTransformer,
use Flowable.compose(FlowableTransformer)
to apply the operators to an existing sequence.| Modifier and Type | Method and Description |
|---|---|
static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> |
bufferSplit(io.reactivex.functions.Predicate<? super T> predicate)
Buffers elements into a List until the given predicate returns true at which
point a new empty buffer is started; the particular item will be dropped.
|
static <T,C extends java.util.Collection<? super T>> |
bufferSplit(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
Buffers elements into a custom collection until the given predicate returns true at which
point a new empty custom collection is started; the particular item will be dropped.
|
static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> |
bufferUntil(io.reactivex.functions.Predicate<? super T> predicate)
Buffers elements into a List until the given predicate returns true at which
point a new empty buffer is started.
|
static <T,C extends java.util.Collection<? super T>> |
bufferUntil(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
Buffers elements into a custom collection until the given predicate returns true at which
point a new empty custom collection is started.
|
static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> |
bufferWhile(io.reactivex.functions.Predicate<? super T> predicate)
Buffers elements into a List while the given predicate returns true; if the
predicate returns false for an item, a new buffer is created with the specified item.
|
static <T,C extends java.util.Collection<? super T>> |
bufferWhile(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
Buffers elements into a custom collection while the given predicate returns true; if the
predicate returns false for an item, a new collection is created with the specified item.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
cacheLast()
Cache the very last value of the flow and relay/replay it to Subscribers.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
debounceFirst(long timeout,
java.util.concurrent.TimeUnit unit)
Debounces the upstream by taking an item and dropping subsequent items until
the specified amount of time elapses after the last item, after which the
process repeats.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
debounceFirst(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Debounces the upstream by taking an item and dropping subsequent items until
the specified amount of time elapses after the last item, after which the
process repeats.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
every(long keep)
Relays every Nth item from upstream.
|
static <T,R> io.reactivex.FlowableTransformer<T,R> |
mapFilter(io.reactivex.functions.BiConsumer<? super T,? super BasicEmitter<R>> consumer)
Allows mapping or filtering an upstream value through an emitter.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
onBackpressureTimeout(int maxSize,
long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
io.reactivex.functions.Consumer<? super T> onEvict)
Buffers the incoming values from upstream up to a maximum size or timeout if
the downstream can't keep up.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
Buffers the incoming values from upstream up to a maximum timeout if
the downstream can't keep up.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Buffers the incoming values from upstream up to a maximum timeout if
the downstream can't keep up, running on a custom scheduler.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
io.reactivex.functions.Consumer<? super T> onEvict)
Buffers the incoming values from upstream up to a maximum size or timeout if
the downstream can't keep up.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
boolean delayError)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
boolean delayError)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit)
Inserts a time delay between emissions from the upstream source.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
boolean delayError)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Inserts a time delay between emissions from the upstream source.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
boolean delayError)
Inserts a time delay between emissions from the upstream source, including an initial delay.
|
static <T,R> io.reactivex.FlowableTransformer<T,R> |
switchFlatMap(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxActive)
Combination of switchMap and flatMap where there is a limit on the number of
concurrent sources to be flattened into a single sequence and if the operator is at
the given maximum active count, a newer source Publisher will switch out the oldest
active source Publisher being merged.
|
static <T,R> io.reactivex.FlowableTransformer<T,R> |
switchFlatMap(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxActive,
int bufferSize)
Combination of switchMap and flatMap where there is a limit on the number of
concurrent sources to be flattened into a single sequence and if the operator is at
the given maximum active count, a newer source Publisher will switch out the oldest
active source Publisher being merged.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
timeoutLast(long timeout,
java.util.concurrent.TimeUnit unit)
Emit the last item when the upstream completes or the
the latest received if the specified timeout elapses since
the last received item.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
timeoutLast(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Emit the last item when the upstream completes or the
the latest received if the specified timeout elapses since
the last received item.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
timeoutLastAbsolute(long timeout,
java.util.concurrent.TimeUnit unit)
Emit the last item when the upstream completes or the
the latest received if the specified timeout elapses
since the start of the sequence.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
timeoutLastAbsolute(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Emit the last item when the upstream completes or the
the latest received if the specified timeout elapses
since the start of the sequence.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
valve(org.reactivestreams.Publisher<java.lang.Boolean> other)
Relays values until the other Publisher signals false and resumes if the other
Publisher signals true again, like closing and opening a valve and not losing
any items from the main source.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
boolean defaultOpen)
Relays values until the other Publisher signals false and resumes if the other
Publisher signals true again, like closing and opening a valve and not losing
any items from the main source and starts with the specivied valve state.
|
static <T> io.reactivex.FlowableTransformer<T,T> |
valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
boolean defaultOpen,
int bufferSize)
Relays values until the other Publisher signals false and resumes if the other
Publisher signals true again, like closing and opening a valve and not losing
any items from the main source and starts with the specivied valve state and the specified
buffer size hint.
|
@SchedulerSupport(value="none") @BackpressureSupport(value=PASS_THROUGH) public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other)
Properties:
IllegalStateException.Scheduler.Flowable.bufferSize() to hold onto values if the valve is closed.T - the value type of the main sourceother - the other sourcejava.lang.NullPointerException - if other is null@SchedulerSupport(value="none")
@BackpressureSupport(value=PASS_THROUGH)
public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
boolean defaultOpen)
Properties:
IllegalStateException.Scheduler.Flowable.bufferSize() to hold onto values if the valve is closed.T - the value type of the main sourceother - the other sourcedefaultOpen - should the valve start as open?java.lang.NullPointerException - if other is null@SchedulerSupport(value="none")
@BackpressureSupport(value=PASS_THROUGH)
public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
boolean defaultOpen,
int bufferSize)
Properties:
IllegalStateException.Scheduler.T - the value type of the main sourceother - the other sourcedefaultOpen - should the valve start as open?bufferSize - the buffer size hint (the chunk size of the underlying unbounded buffer)java.lang.IllegalArgumentException - if bufferSize <= 0java.lang.NullPointerException - if other is null@SchedulerSupport(value="none") @BackpressureSupport(value=FULL) public static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> bufferWhile(io.reactivex.functions.Predicate<? super T> predicate)
T - the source value typepredicate - the predicate receiving the current value and if returns false,
a new buffer is created with the specified item@SchedulerSupport(value="none")
@BackpressureSupport(value=FULL)
public static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C> bufferWhile(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
T - the source value typeC - the collection typepredicate - the predicate receiving the current value and if returns false,
a new collection is created with the specified itembufferSupplier - the callable that returns a fresh collection@SchedulerSupport(value="none") @BackpressureSupport(value=FULL) public static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> bufferUntil(io.reactivex.functions.Predicate<? super T> predicate)
T - the source value typepredicate - the predicate receiving the current item and if returns true,
the current buffer is emitted and a fresh empty buffer is created@SchedulerSupport(value="none")
@BackpressureSupport(value=FULL)
public static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C> bufferUntil(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
T - the source value typeC - the collection typepredicate - the predicate receiving the current item and if returns true,
the current collection is emitted and a fresh empty collection is createdbufferSupplier - the callable that returns a fresh collection@SchedulerSupport(value="none") @BackpressureSupport(value=FULL) public static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> bufferSplit(io.reactivex.functions.Predicate<? super T> predicate)
T - the source value typepredicate - the predicate receiving the current item and if returns true,
the current buffer is emitted and a fresh empty buffer is created@SchedulerSupport(value="none")
@BackpressureSupport(value=FULL)
public static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C> bufferSplit(io.reactivex.functions.Predicate<? super T> predicate,
java.util.concurrent.Callable<C> bufferSupplier)
T - the source value typeC - the collection typepredicate - the predicate receiving the current item and if returns true,
the current collection is emitted and a fresh empty collection is createdbufferSupplier - the callable that returns a fresh collection@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit)
Scheduler.T - the value typebetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay values@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Scheduler you provide.T - the value typebetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesscheduler - the scheduler to delay and emit the values on@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit)
Scheduler.T - the value typeinitialDelay - the initial delaybetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay values@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Scheduler you provide.T - the value typeinitialDelay - the initial delaybetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesscheduler - the scheduler to delay and emit the values on@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
boolean delayError)
Scheduler.T - the value typebetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesdelayError - delay the onError event from upstream@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
boolean delayError)
Scheduler you provide.T - the value typebetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesscheduler - the scheduler to delay and emit the values ondelayError - delay the onError event from upstream@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
boolean delayError)
Scheduler.T - the value typeinitialDelay - the initial delaybetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesdelayError - delay the onError event from upstream@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
long betweenDelay,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
boolean delayError)
Scheduler you provide.T - the value typeinitialDelay - the initial delaybetweenDelay - the (minimum) delay time between elementsunit - the time unit of the initial delay and the between delay valuesscheduler - the scheduler to delay and emit the values ondelayError - delay the onError event from upstream@BackpressureSupport(value=PASS_THROUGH) @SchedulerSupport(value="none") public static <T,R> io.reactivex.FlowableTransformer<T,R> mapFilter(io.reactivex.functions.BiConsumer<? super T,? super BasicEmitter<R>> consumer)
T - the input value typeR - the output value typeconsumer - the consumer that is called for each upstream value and should call one of the doXXX methods
on the BasicEmitter it receives (individual to each Subscriber).@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
T - the value typetimeout - the maximum age of an element in the bufferunit - the time unit of the timeoutfor more options@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
io.reactivex.functions.Consumer<? super T> onEvict)
T - the value typetimeout - the maximum age of an element in the bufferunit - the time unit of the timeoutscheduler - the scheduler to be used as time source and to trigger the timeout & evictiononEvict - called when an element is evicted, maybe concurrently@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
T - the value typetimeout - the maximum age of an element in the bufferunit - the time unit of the timeoutscheduler - the scheduler to be used as time source and to trigger the timeout & evictionfor more options@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(int maxSize,
long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler,
io.reactivex.functions.Consumer<? super T> onEvict)
T - the value typemaxSize - the maximum number of elements in the buffer, beyond that,
the oldest element is evictedtimeout - the maximum age of an element in the bufferunit - the time unit of the timeoutscheduler - the scheduler to be used as time source and to trigger the timeout & evictiononEvict - called when an element is evicted, maybe concurrently@BackpressureSupport(value=SPECIAL) @SchedulerSupport(value="none") public static <T> io.reactivex.FlowableTransformer<T,T> every(long keep)
times what the downstream requests and skips @code keep-1} items.Scheduler.T - the value typekeep - the period of items to keep, i.e., this minus one items will be dropped
before emitting an item directly@BackpressureSupport(value=UNBOUNDED_IN) @SchedulerSupport(value="none") public static <T> io.reactivex.FlowableTransformer<T,T> cacheLast()
The operator subscribes to the upstream when the first downstream Subscriber arrives. Once connected, the upstream can't be stopped from the downstream even if all Subscribers cancel.
A difference from replay(1) is that replay() is likely
holding onto 2 references due to continuity requirements whereas this
operator is guaranteed to hold only the very last item.
T - the value type emitted@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> timeoutLast(long timeout,
java.util.concurrent.TimeUnit unit)
T - the value typetimeout - the timeout valueunit - the timeout time unit@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> timeoutLast(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
T - the value typetimeout - the timeout valueunit - the timeout time unitscheduler - the scheduler to run the timeout and possible emit the last/latest@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> timeoutLastAbsolute(long timeout,
java.util.concurrent.TimeUnit unit)
T - the value typetimeout - the timeout valueunit - the timeout time unit@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> timeoutLastAbsolute(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
T - the value typetimeout - the timeout valueunit - the timeout time unitscheduler - the scheduler to run the timeout and possible emit the last/latest@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="io.reactivex:computation")
public static <T> io.reactivex.FlowableTransformer<T,T> debounceFirst(long timeout,
java.util.concurrent.TimeUnit unit)
Note that the operator uses the computation Scheduler for
the source of time but doesn't use it to emit non-dropped items or terminal events.
The operator uses calculation with the current time to decide if an upstream
item may pass or not.
T - the value typetimeout - the timeoutunit - the unit of measure of the timeout parameter@BackpressureSupport(value=PASS_THROUGH)
@SchedulerSupport(value="custom")
public static <T> io.reactivex.FlowableTransformer<T,T> debounceFirst(long timeout,
java.util.concurrent.TimeUnit unit,
io.reactivex.Scheduler scheduler)
Note that the operator uses the computation Scheduler for
the source of time but doesn't use it to emit non-dropped items or terminal events.
The operator uses calculation with the current time to decide if an upstream
item may pass or not.
T - the value typetimeout - the timeoutunit - the unit of measure of the timeout parameterscheduler - the scheduler used for getting the current time when
evaluating upstream items@BackpressureSupport(value=FULL)
@SchedulerSupport(value="none")
public static <T,R> io.reactivex.FlowableTransformer<T,R> switchFlatMap(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxActive)
T - the source value typeR - the result value typemapper - the function that maps an upstream value into a Publisher to be merged/switchedmaxActive - the maximum number of active inner Publishers@BackpressureSupport(value=FULL)
@SchedulerSupport(value="none")
public static <T,R> io.reactivex.FlowableTransformer<T,R> switchFlatMap(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxActive,
int bufferSize)
T - the source value typeR - the result value typemapper - the function that maps an upstream value into a Publisher to be merged/switchedmaxActive - the maximum number of active inner PublishersbufferSize - the number of items to prefetch from each inner source