Java Code Examples for io.reactivex.Flowable#merge()
The following examples show how to use
io.reactivex.Flowable#merge() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchDialog.java From jadx with Apache License 2.0 | 6 votes |
private void searchFieldSubscribe() { searchEmitter = new SearchEventEmitter(); Flowable<String> textChanges = onTextFieldChanges(searchField); Flowable<String> searchEvents = Flowable.merge(textChanges, searchEmitter.getFlowable()); searchDisposable = searchEvents .filter(text -> text.length() > 0) .subscribeOn(Schedulers.single()) .doOnNext(r -> LOG.debug("search event: {}", r)) .switchMap(text -> prepareSearch(text) .doOnError(e -> LOG.error("Error prepare search: {}", e.getMessage(), e)) .subscribeOn(Schedulers.single()) .toList() .toFlowable(), 1) .observeOn(SwingSchedulers.edt()) .doOnError(e -> LOG.error("Error while searching: {}", e.getMessage(), e)) .subscribe(this::processSearchResults); }
Example 2
Source File: Flowables.java From cyclops with Apache License 2.0 | 5 votes |
public static <T> Flowable<Single<T>> sequence(final Publisher<? extends Flowable<T>> fts) { io.reactivex.functions.BiFunction<Flowable<Single<T>>,Flowable<T>,Flowable<Single<T>>> combineToStream = (acc,next) ->Flowable.merge(acc,next.map(Single::just)); Single<Flowable<Single<T>>> x = Flowable.fromPublisher(fts).reduce(Flowable.empty(), combineToStream); Flowable<Flowable<Single<T>>> r = x.flatMapPublisher(Flowable::just); return r.flatMap(i->i); }
Example 3
Source File: RedissonKeysRx.java From redisson with Apache License 2.0 | 5 votes |
public Flowable<String> getKeysByPattern(String pattern, int count) { List<Publisher<String>> publishers = new ArrayList<Publisher<String>>(); for (MasterSlaveEntry entry : commandExecutor.getConnectionManager().getEntrySet()) { publishers.add(createKeysIterator(entry, pattern, count)); } return Flowable.merge(publishers); }