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


Java Flowable.fromPublisher方法代码示例

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


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

示例1: createFlattenedStream

import io.reactivex.Flowable; //导入方法依赖的package包/类
private <T> ErrorStreamPair<T> createFlattenedStream(FlattenedStreamId<T> id, DiscoveryService discoveryService) {
    Flowable<? extends Iterable<? extends T>> sourceStream = Flowable.fromPublisher(discoveryService.discover(id.sourceStreamId()));

    return ErrorStreamPair.ofData(sourceStream.flatMap(iterable -> {
        Stream<? extends T> stream = StreamSupport.stream(iterable.spliterator(), false).filter(Objects::nonNull);
        return Flowable.fromIterable(stream.collect(Collectors.toList()));
    }));
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:9,代码来源:FlattenedStreamFactory.java

示例2: createDerivedStream

import io.reactivex.Flowable; //导入方法依赖的package包/类
private <S, T> ErrorStreamPair<T> createDerivedStream(DerivedStreamId<S, T> id, DiscoveryService discoveryService) {
    Flowable<S> sourceStream = Flowable.fromPublisher(discoveryService.discover(id.sourceStreamId()));
    Function<S, T> conversion = id.conversion();

    ErrorDeflector ed = ErrorDeflector.create();
    return ed.streamNonEmpty(sourceStream.map(ed.emptyOnException(conversion)));
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:8,代码来源:DerivedStreamFactory.java

示例3: combineWithLatestStream

import io.reactivex.Flowable; //导入方法依赖的package包/类
private <T, D, Y> Publisher<Y> combineWithLatestStream(CombineWithLatestStreamId<T, D, Y> streamId,
        DiscoveryService discoveryService) {
    Flowable<D> data = Flowable.fromPublisher(discoveryService.discover(streamId.dataStream()));
    Flowable<T> trigger = Flowable.fromPublisher(discoveryService.discover(streamId.triggerStream()));

    return trigger.withLatestFrom(data, streamId.combiner()::apply);
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:8,代码来源:CombineWithLatestStreamFactory.java

示例4: onCreate

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LiveData<List<Dog>> dogs = monarchy.findAllMappedWithChanges(realm -> realm.where(RealmDog.class),
                                                           from -> Dog.create(from.getName()));
    this.dogs = Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(getActivity(), dogs));
}
 
开发者ID:Zhuinden,项目名称:realm-monarchy,代码行数:8,代码来源:MappedRxFragment.java

示例5: rxFrom

import io.reactivex.Flowable; //导入方法依赖的package包/类
default <T> Flowable<T> rxFrom(StreamId<T> id) {
    return Flowable.fromPublisher(discover(id));
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:4,代码来源:RxStreamSupport.java

示例6: rxFrom

import io.reactivex.Flowable; //导入方法依赖的package包/类
/**
 * @deprecated rxjava2 has {@link Flowable#fromPublisher(Publisher)}
 */
public static <T> Flowable<T> rxFrom(Publisher<T> stream) {
    return Flowable.fromPublisher(stream);
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:7,代码来源:ReactiveStreams.java

示例7: flowable

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

示例8: play

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<T> play(PlayOptions options){
    return Flowable.fromPublisher(reactivePlayer.play(options));
}
 
开发者ID:danielshaya,项目名称:reactivejournal,代码行数:4,代码来源:RxJavaPlayer.java

示例9: DataStreamImpl

import io.reactivex.Flowable; //导入方法依赖的package包/类
public DataStreamImpl(List<DataStream> upstreams, Publisher<Data<T>> flow) {
  Objects.requireNonNull(flow, "The flow passed to the stream cannot be `null`");
  this.flow = Flowable.fromPublisher(flow);
  this.upstreams = Collections.unmodifiableList(upstreams);
  this.connectable = false;
}
 
开发者ID:cescoffier,项目名称:fluid,代码行数:7,代码来源:DataStreamImpl.java

示例10: adoptFluxToRxJava2Flowable

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

	Flux<String> people = Flux.just("Jesse", "Hank");

	Flowable<String> flowable = Flowable.fromPublisher(people);

	flowable.test().await().assertResult("Jesse", "Hank").awaitTerminalEvent();
}
 
开发者ID:mp911de,项目名称:reactive-spring,代码行数:10,代码来源:Step6Adapters.java


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