public final class RxUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RxUtil.CountingAction<T> |
Modifier and Type | Method and Description |
---|---|
static <T> rx.Observable.Operator<T,rx.Observable<T>> |
concat() |
static <T> rx.Observable<T> |
concatButIgnoreFirstSequence(rx.Observable<?> o1,
rx.Observable<T> o2)
Returns the concatenation of two
Observable s but the first
sequence will be emitted in its entirety and ignored before o2 starts
emitting. |
static <T> RxUtil.CountingAction<T> |
counter()
Returns an
Action1 that increments a counter when the call method
is called. |
static <T> rx.Observable.Operator<T,rx.Observable<T>> |
flatten()
Returns an
Observable.Operator that flattens a sequence of
Observable into a flat sequence of the items from the
Observables. |
static <T> long |
getAndAddRequest(AtomicLongFieldUpdater<T> requested,
T object,
long n)
Adds
n to requested field and returns the value prior to
addition once the addition is successful (uses CAS semantics). |
static long |
getAndAddRequest(AtomicLong requested,
long n)
Adds
n to requested and returns the value prior to addition once the
addition is successful (uses CAS semantics). |
static <T extends Number> |
greaterThanZero() |
static <T> rx.Observer<? super T> |
log()
Logs errors and onNext at info level using slf4j
Logger . |
static <T> rx.functions.Func1<T,rx.Observable<Object>> |
toEmpty()
Returns a
Func1 that returns an empty Observable . |
static <R,T> rx.Observable.Operator<R,T> |
toOperator(rx.functions.Func1<rx.Observable<T>,rx.Observable<R>> operation)
Converts a transformation of an Observable into another Observable into
an
Observable.Operator suitable for use with
Observable.lift(Operator) for instance. |
public static <T> rx.Observable<T> concatButIgnoreFirstSequence(rx.Observable<?> o1, rx.Observable<T> o2)
Observable
s but the first
sequence will be emitted in its entirety and ignored before o2 starts
emitting.T
- the generic type of the second observableo1
- the sequence to ignoreo2
- the sequence to emit after o1 ignoredpublic static <T> rx.Observer<? super T> log()
Logger
.T
- the return generic typeObserver
public static <R,T> rx.Observable.Operator<R,T> toOperator(rx.functions.Func1<rx.Observable<T>,rx.Observable<R>> operation)
Observable.Operator
suitable for use with
Observable.lift(Operator)
for instance.R
- from generic typeT
- to generic typeoperation
- public static <T> RxUtil.CountingAction<T> counter()
Action1
that increments a counter when the call method
is called.T
- generic type of item being countedAction1
to count calls.public static <T> rx.functions.Func1<T,rx.Observable<Object>> toEmpty()
Func1
that returns an empty Observable
.public static <T> rx.Observable.Operator<T,rx.Observable<T>> flatten()
Observable.Operator
that flattens a sequence of
Observable
into a flat sequence of the items from the
Observables. This operator may interleave the items asynchronously. For
synchronous behaviour use concat()
.public static <T> rx.Observable.Operator<T,rx.Observable<T>> concat()
public static <T> long getAndAddRequest(AtomicLongFieldUpdater<T> requested, T object, long n)
n
to requested
field and returns the value prior to
addition once the addition is successful (uses CAS semantics). If
overflows then sets requested
field to Long.MAX_VALUE
.requested
- atomic field updater for a request countobject
- contains the field updated by the updatern
- the number of requests to add to the requested countpublic static long getAndAddRequest(AtomicLong requested, long n)
n
to requested
and returns the value prior to addition once the
addition is successful (uses CAS semantics). If overflows then sets
requested
field to Long.MAX_VALUE
.requested
- atomic field updater for a request countobject
- contains the field updated by the updatern
- the number of requests to add to the requested countCopyright © 2014–2015. All rights reserved.