本文整理汇总了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);
}
示例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);
}
示例3: prepareRxStreamWith
import io.reactivex.Flowable; //导入方法依赖的package包/类
private static <T> Flowable<T> prepareRxStreamWith(List<T> items) {
return Flowable.fromIterable(items);
}
示例4: flowable
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<T> flowable() {
return Flowable.fromIterable(get());
}
示例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