Completable addPlayersToPlayersMap(PlayerDao dao, Observable<Game> gamesORx)
{
return gamesORx
.map(game -> game.id)
.distinct()
.flatMapCompletable(gameId ->
dao.players().loadPlayers(gameId)
.flatMapCompletable(player -> {
playersMap.put(playerId, player);
return Completable.complete();
})
);
}
我想改变flatMapCompletable - &gt; flatMap&amp;&amp;删除Completable.complete(),原因.put()是同步操作,但在main()函数中我使用Completable.mergeArray({addPlayersToMap,etc ...})。
我该如何解决这个问题?