cyclops.reactive.ObservableReactiveSeq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops-rx2-integration Show documentation
Show all versions of cyclops-rx2-integration Show documentation
Cyclops integration with RxJava 2
package cyclops.reactive;
import com.oath.cyclops.rx2.adapter.ObservableReactiveSeqImpl;
import cyclops.companion.rx2.Observables;
import io.reactivex.Observable;
import io.reactivex.Scheduler;
import io.reactivex.schedulers.Schedulers;
import java.util.concurrent.TimeUnit;
/*
Factory methods for creating Observable backed ReactiveSeq instances
*/
public interface ObservableReactiveSeq {
public static ReactiveSeq reactiveSeq(Observable observable) {
return new ObservableReactiveSeqImpl<>(observable);
}
public static ReactiveSeq empty() {
return reactiveSeq(Observable.empty());
}
public static ReactiveSeq error(Throwable exception) {
return reactiveSeq(Observable.error(exception));
}
public static ReactiveSeq from(Iterable extends T> iterable) {
return reactiveSeq(Observable.fromIterable(iterable));
}
public static ReactiveSeq interval(long interval, TimeUnit unit) {
return interval(interval, interval, unit, Schedulers.computation());
}
public static ReactiveSeq interval(long interval, TimeUnit unit, Scheduler scheduler) {
return interval(interval, interval, unit, scheduler);
}
public static ReactiveSeq interval(long initialDelay, long period, TimeUnit unit) {
return interval(initialDelay, period, unit, Schedulers.computation());
}
public static ReactiveSeq interval(long initialDelay, long period, TimeUnit unit, Scheduler scheduler) {
return reactiveSeq(Observable.interval(initialDelay,period,unit,scheduler));
}
public static ReactiveSeq just(final T value) {
return reactiveSeq(Observable.just(value));
}
@SafeVarargs
public static ReactiveSeq just(final T... values) {
T[] array = values;
return reactiveSeq(Observable.fromArray(array));
}
public static ReactiveSeq of(final T value) {
return just(value);
}
@SafeVarargs
public static ReactiveSeq of(final T... values) {
return just(values);
}
public static ReactiveSeq merge(Iterable extends Observable extends T>> sequences) {
return merge(from(sequences));
}
public static ReactiveSeq merge(Iterable extends Observable extends T>> sequences, int maxConcurrent) {
return merge(from(sequences), maxConcurrent);
}
public static ReactiveSeq merge(Observable extends Observable extends T>> source) {
return reactiveSeq(Observable.merge(source));
}
public static ReactiveSeq merge(Observable extends Observable extends T>> source, int maxConcurrent) {
return reactiveSeq(Observable.merge(source,maxConcurrent));
}
public static ReactiveSeq mergeDelayError(Observable extends Observable extends T>> source) {
return reactiveSeq(Observable.mergeDelayError(source));
}
public static ReactiveSeq mergeDelayError(Observable extends Observable extends T>> source, int maxConcurrent) {
return reactiveSeq(Observable.mergeDelayError(source,maxConcurrent));
}
public static ReactiveSeq mergeDelayError(Iterable extends Observable extends T>> sequences) {
return mergeDelayError(from(sequences));
}
public static ReactiveSeq mergeDelayError(Iterable extends Observable extends T>> sequences, int maxConcurrent) {
return mergeDelayError(from(sequences), maxConcurrent);
}
public static ReactiveSeq never() {
return reactiveSeq(Observable.never());
}
public static ReactiveSeq range(int start, int count) {
return reactiveSeq(Observable.range(start,count));
}
public static ReactiveSeq switchOnNext(Observable extends Observable extends T>> sequenceOfSequences) {
return reactiveSeq(Observable.switchOnNext(sequenceOfSequences));
}
public static ReactiveSeq switchOnNextDelayError(Observable extends Observable extends T>> sequenceOfSequences) {
return reactiveSeq(Observable.switchOnNext(sequenceOfSequences));
}
public static ReactiveSeq timer(long initialDelay, long period, TimeUnit unit) {
return interval(initialDelay, period, unit, Schedulers.computation());
}
public static ReactiveSeq timer(long delay, TimeUnit unit) {
return timer(delay, unit, Schedulers.computation());
}
public static ReactiveSeq timer(long delay, TimeUnit unit, Scheduler scheduler) {
return reactiveSeq(Observable.timer(delay,unit,scheduler));
}
}