public final class Transformers extends Object
Modifier and Type | Method and Description |
---|---|
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
buffer(int maxSize,
io.reactivex.functions.Function<? super T,? extends Long> duration,
TimeUnit unit)
Buffers the source
Flowable into List s, emitting Lists when
the size of a list reaches maxSize or if the elapsed time since last
emission from the source reaches the given duration. |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
buffer(int maxSize,
io.reactivex.functions.Function<? super T,? extends Long> duration,
TimeUnit unit,
io.reactivex.Scheduler scheduler)
Buffers the source
Flowable into List s, emitting Lists when
the size of a list reaches maxSize or if the elapsed time since last
emission from the source reaches the given duration. |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
buffer(int maxSize,
long duration,
TimeUnit unit)
Buffers the source
Flowable into List s, emitting Lists when
the size of a list reaches maxSize or if the elapsed time since last
emission from the source reaches the given duration. |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
buffer(int maxSize,
long duration,
TimeUnit unit,
io.reactivex.Scheduler scheduler)
Buffers the source
Flowable into List s, emitting Lists when the size of a
list reaches maxSize or if the elapsed time since last emission from
the source reaches the given duration. |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
bufferWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition) |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
bufferWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition,
boolean emitRemainder) |
static <T extends Number> |
collectStats()
Converts a stream of
Number to a stream of Statistics about
those numbers. |
static <T,R extends Number> |
collectStats(io.reactivex.functions.Function<? super T,? extends R> function) |
static <T,R> io.reactivex.FlowableTransformer<T,R> |
collectWhile(Callable<R> collectionFactory,
io.reactivex.functions.BiFunction<? super R,? super T,? extends R> add,
io.reactivex.functions.BiPredicate<? super R,? super T> condition) |
static <T,R> io.reactivex.FlowableTransformer<T,R> |
collectWhile(Callable<R> collectionFactory,
io.reactivex.functions.BiFunction<? super R,? super T,? extends R> add,
io.reactivex.functions.BiPredicate<? super R,? super T> condition,
boolean emitRemainder)
Returns a transformer that emits collections of items with the collection
boundaries determined by the given
BiPredicate . |
static <T> io.reactivex.FlowableTransformer<T,T> |
doOnEmpty(io.reactivex.functions.Action action)
Returns a transformer that when a stream is empty runs the given
Action . |
static <T,R> io.reactivex.FlowableTransformer<T,R> |
flatMapInterleaved(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxConcurrency) |
static <T,R> io.reactivex.FlowableTransformer<T,R> |
flatMapInterleaved(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxConcurrency,
int bufferSize,
boolean delayErrors) |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(io.reactivex.functions.Function<? super T,? extends Long> timeout,
TimeUnit unit,
io.reactivex.functions.Function<? super T,? extends T> value) |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(io.reactivex.functions.Function<? super T,? extends Long> timeout,
TimeUnit unit,
io.reactivex.functions.Function<? super T,? extends T> value,
io.reactivex.Scheduler scheduler) |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(io.reactivex.functions.Function<? super T,? extends Long> timeout,
TimeUnit unit,
T value) |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(io.reactivex.functions.Function<? super T,? extends io.reactivex.Maybe<? extends T>> valueToInsert)
For every onNext emission from the source stream, the
valueToInsert
Maybe is subscribed to. |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(long timeout,
TimeUnit unit,
T value) |
static <T> io.reactivex.FlowableTransformer<T,T> |
insert(io.reactivex.Maybe<? extends T> valueToInsert) |
static <T> io.reactivex.FlowableTransformer<T,T> |
mapLast(io.reactivex.functions.Function<? super T,? extends T> function) |
static <A,B,K,C> io.reactivex.Flowable<C> |
match(io.reactivex.Flowable<A> a,
io.reactivex.Flowable<B> b,
io.reactivex.functions.Function<? super A,K> aKey,
io.reactivex.functions.Function<? super B,K> bKey,
io.reactivex.functions.BiFunction<? super A,? super B,C> combiner,
int requestSize) |
static <A,B,C,K> io.reactivex.FlowableTransformer<A,C> |
matchWith(io.reactivex.Flowable<B> b,
io.reactivex.functions.Function<? super A,K> aKey,
io.reactivex.functions.Function<? super B,K> bKey,
io.reactivex.functions.BiFunction<? super A,? super B,C> combiner) |
static <A,B,C,K> io.reactivex.FlowableTransformer<A,C> |
matchWith(io.reactivex.Flowable<B> b,
io.reactivex.functions.Function<? super A,K> aKey,
io.reactivex.functions.Function<? super B,K> bKey,
io.reactivex.functions.BiFunction<? super A,? super B,C> combiner,
int requestSize) |
static <T> io.reactivex.FlowableTransformer<T,T> |
maxRequest(long... maxRequest) |
static <T> io.reactivex.FlowableTransformer<T,T> |
minRequest(int... minRequests) |
static Options.BuilderFlowable |
onBackpressureBufferToFile() |
static <T> io.reactivex.FlowableTransformer<T,T> |
rebatchRequests(int minRequest,
long maxRequest) |
static <T> io.reactivex.FlowableTransformer<T,T> |
rebatchRequests(int minRequest,
long maxRequest,
boolean constrainFirstRequestMin) |
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> |
reduce(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> reducer,
int maxChained) |
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> |
reduce(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> reducer,
int maxChained,
long maxIterations) |
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> |
repeat(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> transform,
int maxChained,
long maxIterations,
io.reactivex.functions.Function<io.reactivex.Observable<T>,io.reactivex.Observable<?>> tester) |
static <T> io.reactivex.FlowableTransformer<T,T> |
reverse() |
static StateMachine.Builder |
stateMachine() |
static <State,In,Out> |
stateMachine(Callable<? extends State> initialState,
io.reactivex.functions.Function3<? super State,? super In,? super io.reactivex.FlowableEmitter<Out>,? extends State> transition,
io.reactivex.functions.BiPredicate<? super State,? super io.reactivex.FlowableEmitter<Out>> completion,
io.reactivex.BackpressureStrategy backpressureStrategy,
int requestBatchSize) |
static StateMachine2.Builder |
stateMachine2() |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
toListWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition) |
static <T> io.reactivex.FlowableTransformer<T,List<T>> |
toListWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition,
boolean emitRemainder) |
static <T extends Comparable<T>> |
windowMax(int windowSize) |
static <T> io.reactivex.FlowableTransformer<T,T> |
windowMax(int windowSize,
Comparator<? super T> comparator) |
static <T extends Comparable<T>> |
windowMin(int windowSize) |
static <T> io.reactivex.FlowableTransformer<T,T> |
windowMin(int windowSize,
Comparator<? super T> comparator) |
public static <State,In,Out> io.reactivex.FlowableTransformer<In,Out> stateMachine(Callable<? extends State> initialState, io.reactivex.functions.Function3<? super State,? super In,? super io.reactivex.FlowableEmitter<Out>,? extends State> transition, io.reactivex.functions.BiPredicate<? super State,? super io.reactivex.FlowableEmitter<Out>> completion, io.reactivex.BackpressureStrategy backpressureStrategy, int requestBatchSize)
public static StateMachine.Builder stateMachine()
public static StateMachine2.Builder stateMachine2()
public static <T> io.reactivex.FlowableTransformer<T,T> doOnEmpty(io.reactivex.functions.Action action)
Action
.
T
- item typeaction
- to be called when the stream is determined to be empty.public static <T> io.reactivex.FlowableTransformer<T,T> reverse()
public static <T> io.reactivex.FlowableTransformer<T,T> mapLast(io.reactivex.functions.Function<? super T,? extends T> function)
public static <A,B,K,C> io.reactivex.Flowable<C> match(io.reactivex.Flowable<A> a, io.reactivex.Flowable<B> b, io.reactivex.functions.Function<? super A,K> aKey, io.reactivex.functions.Function<? super B,K> bKey, io.reactivex.functions.BiFunction<? super A,? super B,C> combiner, int requestSize)
public static <A,B,C,K> io.reactivex.FlowableTransformer<A,C> matchWith(io.reactivex.Flowable<B> b, io.reactivex.functions.Function<? super A,K> aKey, io.reactivex.functions.Function<? super B,K> bKey, io.reactivex.functions.BiFunction<? super A,? super B,C> combiner, int requestSize)
public static <A,B,C,K> io.reactivex.FlowableTransformer<A,C> matchWith(io.reactivex.Flowable<B> b, io.reactivex.functions.Function<? super A,K> aKey, io.reactivex.functions.Function<? super B,K> bKey, io.reactivex.functions.BiFunction<? super A,? super B,C> combiner)
public static Options.BuilderFlowable onBackpressureBufferToFile()
public static <T extends Number> io.reactivex.FlowableTransformer<T,Statistics> collectStats()
Converts a stream of Number
to a stream of Statistics
about
those numbers.
T
- item typepublic static <T,R extends Number> io.reactivex.FlowableTransformer<T,Pair<T,Statistics>> collectStats(io.reactivex.functions.Function<? super T,? extends R> function)
public static <T,R> io.reactivex.FlowableTransformer<T,R> collectWhile(Callable<R> collectionFactory, io.reactivex.functions.BiFunction<? super R,? super T,? extends R> add, io.reactivex.functions.BiPredicate<? super R,? super T> condition, boolean emitRemainder)
BiPredicate
.
T
- item typeR
- collection typecollectionFactory
- factory to create a new collectionadd
- method to add an item to a collectioncondition
- while true will continue to add to the current collection. Do not
modify the given collection!emitRemainder
- whether to emit the remainder as a collectionpublic static <T,R> io.reactivex.FlowableTransformer<T,R> collectWhile(Callable<R> collectionFactory, io.reactivex.functions.BiFunction<? super R,? super T,? extends R> add, io.reactivex.functions.BiPredicate<? super R,? super T> condition)
public static <T> io.reactivex.FlowableTransformer<T,List<T>> toListWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition, boolean emitRemainder)
public static <T> io.reactivex.FlowableTransformer<T,List<T>> toListWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition)
public static <T> io.reactivex.FlowableTransformer<T,List<T>> bufferWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition, boolean emitRemainder)
public static <T> io.reactivex.FlowableTransformer<T,List<T>> bufferWhile(io.reactivex.functions.BiPredicate<? super List<T>,? super T> condition)
public static <T extends Comparable<T>> io.reactivex.FlowableTransformer<T,T> windowMax(int windowSize)
public static <T> io.reactivex.FlowableTransformer<T,T> windowMax(int windowSize, Comparator<? super T> comparator)
public static <T extends Comparable<T>> io.reactivex.FlowableTransformer<T,T> windowMin(int windowSize)
public static <T> io.reactivex.FlowableTransformer<T,T> windowMin(int windowSize, Comparator<? super T> comparator)
public static <T> io.reactivex.FlowableTransformer<T,T> maxRequest(long... maxRequest)
public static <T> io.reactivex.FlowableTransformer<T,T> minRequest(int... minRequests)
public static <T> io.reactivex.FlowableTransformer<T,T> rebatchRequests(int minRequest, long maxRequest, boolean constrainFirstRequestMin)
public static <T> io.reactivex.FlowableTransformer<T,T> rebatchRequests(int minRequest, long maxRequest)
public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> repeat(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> transform, int maxChained, long maxIterations, io.reactivex.functions.Function<io.reactivex.Observable<T>,io.reactivex.Observable<?>> tester)
public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> reduce(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> reducer, int maxChained, long maxIterations)
public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,io.reactivex.Flowable<T>> reduce(io.reactivex.functions.Function<? super io.reactivex.Flowable<T>,? extends io.reactivex.Flowable<T>> reducer, int maxChained)
public static <T,R> io.reactivex.FlowableTransformer<T,R> flatMapInterleaved(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper, int maxConcurrency)
public static <T,R> io.reactivex.FlowableTransformer<T,R> flatMapInterleaved(io.reactivex.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper, int maxConcurrency, int bufferSize, boolean delayErrors)
public static <T> io.reactivex.FlowableTransformer<T,T> insert(io.reactivex.functions.Function<? super T,? extends io.reactivex.Maybe<? extends T>> valueToInsert)
valueToInsert
Maybe is subscribed to. If the Maybe emits before the next upstream emission
then the result from the Maybe will be inserted into the stream. If the Maybe
does not emit before the next upstream emission then it is cancelled (and no
value is inserted).T
- stream element typevalueToInsert
- a Maybe is calculated from last source emission and subscribed to.
If succeeds before next source emission then result is inserted
into stream.public static <T> io.reactivex.FlowableTransformer<T,T> insert(long timeout, TimeUnit unit, T value)
public static <T> io.reactivex.FlowableTransformer<T,T> insert(io.reactivex.functions.Function<? super T,? extends Long> timeout, TimeUnit unit, T value)
public static <T> io.reactivex.FlowableTransformer<T,T> insert(io.reactivex.functions.Function<? super T,? extends Long> timeout, TimeUnit unit, io.reactivex.functions.Function<? super T,? extends T> value)
public static <T> io.reactivex.FlowableTransformer<T,T> insert(io.reactivex.functions.Function<? super T,? extends Long> timeout, TimeUnit unit, io.reactivex.functions.Function<? super T,? extends T> value, io.reactivex.Scheduler scheduler)
public static <T> io.reactivex.FlowableTransformer<T,T> insert(io.reactivex.Maybe<? extends T> valueToInsert)
public static <T> io.reactivex.FlowableTransformer<T,List<T>> buffer(int maxSize, long duration, TimeUnit unit)
Flowable
into List
s, emitting Lists when
the size of a list reaches maxSize
or if the elapsed time since last
emission from the source reaches the given duration.
Schedulers.computation()
is used for scheduling an inserted emission.T
- type of the source stream itemsmaxSize
- max size of emitted listsduration
- buffered list is emitted if the elapsed time since last emission
from the source reaches this durationunit
- unit of duration
public static <T> io.reactivex.FlowableTransformer<T,List<T>> buffer(int maxSize, long duration, TimeUnit unit, io.reactivex.Scheduler scheduler)
Flowable
into List
s, emitting Lists when the size of a
list reaches maxSize
or if the elapsed time since last emission from
the source reaches the given duration.T
- type of the source stream itemsmaxSize
- max size of emitted listsduration
- buffered list is emitted if the elapsed time since last emission
from the source reaches this durationunit
- unit of duration
scheduler
- scheduler to use to schedule emission of a buffer (as a list) if
the time since last emission from the source reaches durationpublic static <T> io.reactivex.FlowableTransformer<T,List<T>> buffer(int maxSize, io.reactivex.functions.Function<? super T,? extends Long> duration, TimeUnit unit)
Flowable
into List
s, emitting Lists when
the size of a list reaches maxSize
or if the elapsed time since last
emission from the source reaches the given duration. An emission on timeout
is scheduled on Schedulers.computation()
.T
- type of the source stream itemsmaxSize
- max size of emitted listsduration
- function that based on the last emission calculates the elapsed
time to be used before emitting a buffered listunit
- unit of duration
public static <T> io.reactivex.FlowableTransformer<T,List<T>> buffer(int maxSize, io.reactivex.functions.Function<? super T,? extends Long> duration, TimeUnit unit, io.reactivex.Scheduler scheduler)
Flowable
into List
s, emitting Lists when
the size of a list reaches maxSize
or if the elapsed time since last
emission from the source reaches the given duration.T
- type of the source stream itemsmaxSize
- max size of emitted listsduration
- function that based on the last emission calculates the elapsed
time to be used before emitting a buffered listunit
- unit of duration
scheduler
- scheduler to use to schedule emission of a buffer (as a list) if
the time since last emission from the source reaches durationCopyright © 2013–2020. All rights reserved.