本文整理了Java中rx.Observable.flatMapIterable()
方法的一些代码示例,展示了Observable.flatMapIterable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.flatMapIterable()
方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:flatMapIterable
[英]Returns an Observable that merges each item emitted by the source Observable with the values in an Iterable corresponding to that item that is generated by a selector.
Scheduler: flatMapIterable does not operate by default on a particular Scheduler.
[中]
代码示例来源:origin: io.github.moacchain/core
public Observable<Transaction> catchUpToLatestAndSubscribeToNewTransactionsObservable(
DefaultBlockParameter startBlock, long pollingInterval) {
return catchUpToLatestAndSubscribeToNewBlocksObservable(
startBlock, true, pollingInterval)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: org.nervos/core
public Observable<Transaction> catchUpToLatestAndSubscribeToNewTransactionsObservable(
DefaultBlockParameter startBlock, long pollingInterval) {
return catchUpToLatestAndSubscribeToNewBlocksObservable(
startBlock, true, pollingInterval)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: io.github.moacchain/core
public Observable<Transaction> replayTransactionsObservable(
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
return replayBlocksObservable(startBlock, endBlock, true)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: FISCO-BCOS/web3sdk
public Observable<Transaction> replayTransactionsObservable(
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
return replayBlocksObservable(startBlock, endBlock, true)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: FISCO-BCOS/web3sdk
public Observable<Transaction> catchUpToLatestAndSubscribeToNewTransactionsObservable(
DefaultBlockParameter startBlock, long pollingInterval) {
return catchUpToLatestAndSubscribeToNewBlocksObservable(
startBlock, true, pollingInterval)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: org.nervos/core
public Observable<Transaction> replayTransactionsObservable(
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
return replayBlocksObservable(startBlock, endBlock, true)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: org.nervos/core
public Observable<Transaction> transactionObservable(long pollingInterval) {
return blockObservable(true, pollingInterval)
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: Aptoide/aptoide-client-v8
public Observable<Download> getCurrentDownload() {
return getDownloads().flatMapIterable(downloads -> downloads)
.filter(downloads -> downloads.getOverallDownloadStatus() == Download.PROGRESS);
}
代码示例来源:origin: org.nervos/core
public Observable<Transaction> catchUpToLatestTransactionObservable(
DefaultBlockParameter startBlock) {
return catchUpToLatestBlockObservable(
startBlock, true, Observable.empty())
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: neow3j/neow3j
public Observable<Transaction> catchUpToLatestTransactionObservable(
BlockParameter startBlock) {
return catchUpToLatestBlockObservable(
startBlock, true, Observable.empty())
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: davidmoten/rxjava-extras
@Override
public Observable<T> call(Observable<T> o) {
return o.toSortedList().flatMapIterable(Functions.<List<T>> identity());
}
};
代码示例来源:origin: io.github.moacchain/core
public Observable<Transaction> catchUpToLatestTransactionObservable(
DefaultBlockParameter startBlock) {
return catchUpToLatestBlockObservable(
startBlock, true, Observable.empty())
.flatMapIterable(JsonRpc2_0Rx::toTransactions);
}
代码示例来源:origin: com.github.davidmoten/rxjava-extras
@Override
public Observable<T> call(Observable<T> o) {
return o.toSortedList().flatMapIterable(Functions.<List<T>> identity());
}
};
代码示例来源:origin: Aptoide/aptoide-client-v8
@Override public Completable pauseAllDownloads() {
return downloadsRepository.getDownloadsInProgress()
.filter(downloads -> !downloads.isEmpty())
.flatMapIterable(downloads -> downloads)
.flatMap(download -> getAppDownloader(download.getMd5()).flatMapCompletable(
appDownloader -> appDownloader.pauseAppDownload())
.map(appDownloader -> download))
.toCompletable();
}
代码示例来源:origin: spencergibb/myfeed
public Observable<List<FeedItem>> feed(String username) {
return user.findId(username).toObservable()
.flatMap(userid -> {
if (StringUtils.hasText(userid)) {
return Observable.from(repo.findByUserid(userid));
} else {
return Observable.just(singletonFeed("Unknown user: " + username));
}
})
// sort by created desc since redis repo doesn't support order
.flatMapIterable(feedItems -> feedItems)
.toSortedList((feedItem1, feedItem2) -> feedItem2.getCreated().compareTo(feedItem1.getCreated()));
}
代码示例来源:origin: com.github.davidmoten/rxjava-extras
@Override
public Observable<T> call(Observable<T> o) {
return o.toSortedList(Functions.toFunc2(comparator))
.flatMapIterable(Functions.<List<T>> identity());
}
};
代码示例来源:origin: davidmoten/rxjava-extras
@Override
public Observable<T> call(Observable<T> o) {
return o.toSortedList(Functions.toFunc2(comparator))
.flatMapIterable(Functions.<List<T>> identity());
}
};
代码示例来源:origin: nurkiewicz/rxjava-book-examples
Observable<PGNotification> pollForNotifications(
long pollingPeriod,
AbstractJdbc2Connection pgConn) {
return Observable
.interval(0, pollingPeriod, TimeUnit.MILLISECONDS)
.flatMap(x -> tryGetNotification(pgConn))
.filter(arr -> arr != null)
.flatMapIterable(Arrays::asList);
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Test
public void sample_147() throws Exception {
Observable<Integer> odd = Observable
.range(1, 7)
.buffer(1, 2)
.flatMapIterable(list -> list);
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
Observable<Item> observeNewItems() {
return Observable
.interval(1, TimeUnit.SECONDS)
.flatMapIterable(x -> query())
.distinct();
}
内容来源于网络,如有侵权,请联系作者删除!