当前位置: 首页>>代码示例>>Java>>正文


Java Flowable.merge方法代码示例

本文整理汇总了Java中io.reactivex.Flowable.merge方法的典型用法代码示例。如果您正苦于以下问题:Java Flowable.merge方法的具体用法?Java Flowable.merge怎么用?Java Flowable.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.Flowable的用法示例。


在下文中一共展示了Flowable.merge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test2

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Test
public void test2() {
    Flowable<Long> trigger = Flowable
            .merge(asList(delayed(500), delayed(3500), delayed(4500), delayed(6500), delayed(8500)));
    Flowable<Long> data = Flowable.interval(1000, MILLISECONDS);

    subscribeAndWait(data, trigger);

    assertThat(subscriber.values()).containsExactly(2L, 3L, 5L, 7L);
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:11,代码来源:CombineWithLatestStreamIdStreamTest.java

示例2: mergeWith

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
@SafeVarargs
public final DataStream<T> mergeWith(DataStream<T>... streams) {
  Objects.requireNonNull(streams, NULL_STREAMS_MESSAGE);
  List<DataStream<T>> list = new ArrayList<>();
  list.add(this);
  list.addAll(Arrays.asList(streams));

  Flowable<Data<T>> merged = Flowable.merge(list.stream()
    .map(DataStream::flow)
    .collect(Collectors.toList())
  );

  List<DataStream> previous = new ArrayList<>();
  previous.add(this);
  previous.addAll(Arrays.asList(streams));

  DataStreamImpl<Object, T> next = new DataStreamImpl<>(previous, merged);
  this.setDownstreams(next);
  Arrays.stream(streams).forEach(d -> d.setDownstreams(next));

  return next;
}
 
开发者ID:cescoffier,项目名称:fluid,代码行数:24,代码来源:DataStreamImpl.java

示例3: mergedStream

import io.reactivex.Flowable; //导入方法依赖的package包/类
/**
 * EXPERIMENTAL Creates a {@link StreamId} that will be used to create a {@link org.reactivestreams.Publisher} which
 * will emit all the items emitted by the {@link org.reactivestreams.Publisher}s identified by the provided
 * {@link StreamId}s.
 *
 * @param sourceStreamIds {@link List} of {@link StreamId}s which identify {@link org.reactivestreams.Publisher}s
 *            that will be used as the source of the new {@link org.reactivestreams.Publisher}.
 * @return A {@link StreamId}.
 * @throws IllegalArgumentException If the provided list of source stream ids is null or empty.
 * @see Flowable#merge(Iterable)
 */
public static final <X> StreamId<X> mergedStream(final List<StreamId<X>> sourceStreamIds) {
    checkCollectionAndThrow(sourceStreamIds, "sourceStreamIds");
    return new CompositionStreamId<>(sourceStreamIds, reactiveStreams -> {
        List<Flowable<X>> observablesToMerge = new ArrayList<>();
        for (Publisher<X> reactiveStream : reactiveStreams) {
            observablesToMerge.add(Flowable.fromPublisher(reactiveStream));
        }
        return Flowable.merge(observablesToMerge);
    });
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:22,代码来源:ComposedStreams.java

示例4: flowEach

import io.reactivex.Flowable; //导入方法依赖的package包/类
/**
 * @param promise
 * @param strategy The {@link BackpressureStrategy} to use
 * @param <T>
 * @param <I>
 * @return
 * @see RxRatpack#observeEach(Promise)
 */
public static <T, I extends Iterable<T>> Flowable<T> flowEach(Promise<I> promise, BackpressureStrategy strategy) {
  return Flowable.merge(flow(promise, strategy).map(Flowable::fromIterable));
}
 
开发者ID:drmaas,项目名称:ratpack-rx2,代码行数:12,代码来源:RxRatpack.java


注:本文中的io.reactivex.Flowable.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。