/** * <p> * Returns the source {@link Observable} merged with the <code>other</code> * observable using the given {@link Comparator} for order. A precondition * is that the source and other are already ordered. This transformer * supports backpressure and its inputs must also support backpressure. * * <p> * <img src= * "https://github.com/davidmoten/rxjava-extras/blob/master/src/docs/orderedMerge.png?raw=true" * alt="marble diagram"> * * @param other * the other already ordered observable * @param comparator * the ordering to use * @param <T> * the generic type of the objects being compared * @return merged and ordered observable */ public static final <T> Transformer<T, T> orderedMergeWith(final Observable<T> other, final Comparator<? super T> comparator) { @SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator); }
/** * <p> * Returns the source {@link Observable} merged with the <code>other</code> * observable using the given {@link Comparator} for order. A precondition * is that the source and other are already ordered. This transformer * supports backpressure and its inputs must also support backpressure. * * <p> * <img src= * "https://github.com/davidmoten/rxjava-extras/blob/master/src/docs/orderedMerge.png?raw=true" * alt="marble diagram"> * * @param other * the other already ordered observable * @param comparator * the ordering to use * @param <T> * the generic type of the objects being compared * @return merged and ordered observable */ public static final <T> Transformer<T, T> orderedMergeWith(final Observable<T> other, final Comparator<? super T> comparator) { @SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator); }
public static <T extends Resource> Observable<OrderByRowResult<T>> orderedMerge(Class<T> klass, OrderbyRowComparer<T> consumeComparer, RequestChargeTracker tracker, List<DocumentProducer<T>> documentProducers) { return toOrderByQueryResultObservable(klass, documentProducers.get(0), tracker) .compose( Transformers.orderedMergeWith( documentProducers.subList(1, documentProducers.size()) .stream() .map(producer -> toOrderByQueryResultObservable(klass, producer, tracker)) .collect(Collectors.toList()), consumeComparer, false, 1)); }
@SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator, delayErrors, bufferSize);
@SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator, delayErrors, bufferSize);