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


Java Flowable.fromIterable方法代码示例

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


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

示例1: test

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Test
public void test() throws InterruptedException {
    // The values we want to publish on the stream
    Iterable<Integer> streamValues = Arrays.asList(1, 2, 3, 4, 5);
    // The actual stream. NOTE: it can be any implementation of a Publisher interface
    Flowable<Integer> stream = Flowable.fromIterable(streamValues);
    // The key for referring to the stream
    StreamId<Integer> streamId = NamedStreamId.ofName("Any stream id");

    // This will register the stream in the Streaming Pool system
    providingService.provide(streamId, stream);

    TestSubscriber<Integer> subscriber = TestSubscriber.create();
    // With a test subscriber from RxJava2 we receives the values
    discoveryService.discover(streamId).subscribe(subscriber);

    subscriber.await();
    subscriber.assertValueSequence(streamValues);
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:20,代码来源:SimpleDiscoveryAndProvide.java

示例2: findAll

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public synchronized Flowable<DocumentWithKey> findAll(String collection) {
  Objects.requireNonNull(collection, NULL_COLLECTION_MESSAGE);
  List<DocumentWithKey> documentsWithIds = documents.computeIfAbsent(collection, key -> new LinkedHashMap<>()).entrySet().stream().
    map(entry -> new DocumentWithKey(entry.getKey(), entry.getValue())).collect(toList());
  return Flowable.fromIterable(documentsWithIds);
}
 
开发者ID:cescoffier,项目名称:fluid,代码行数:8,代码来源:InMemoryDocumentView.java

示例3: prepareRxStreamWith

import io.reactivex.Flowable; //导入方法依赖的package包/类
private static <T> Flowable<T> prepareRxStreamWith(List<T> items) {
    return Flowable.fromIterable(items);
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:4,代码来源:ArchitectureTest.java

示例4: flowable

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<T> flowable() {
  return Flowable.fromIterable(get());
}
 
开发者ID:XDean,项目名称:Java-EX,代码行数:5,代码来源:NullableIterable.java

示例5: shoulIntegrate_DataDispatching_AvailableData

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Test public void shoulIntegrate_DataDispatching_AvailableData() throws Exception {

        View labelMessage = activity.findViewById(R.id.label_feedback_message);

        List<FactViewModel> facts = Arrays.asList(
                new NumberAndFact("1", "1 is the first"),
                new NumberAndFact("2", "2 is the second")
        );

        Flowable<FactViewModel> dataFlow = Flowable.fromIterable(facts);
        FactsAdapter adapter = activity.adapter;

        activity.subscribeInto(dataFlow);

        assertThat(adapter.getItemCount()).isEqualTo(facts.size());
        assertThat(labelMessage.getVisibility()).isEqualTo(View.GONE);

    }
 
开发者ID:ubiratansoares,项目名称:reactive-architectures-playground,代码行数:19,代码来源:FactsAboutNumbersActivityTest.java


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