1 回答

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個(gè)贊
您可以使用可迭代的:
List<Single<String>> singles = Arrays.asList(Single.just("1"), Single.just("2"), Single.just("3"));
Single<List<String>> zip = Single.zip(singles, objects -> Stream.of(objects).map(o -> (String) o).collect(Collectors.toList()));
在你的情況下:
List<Single<Response<MyResponse>>> singles = Arrays.asList(getNyRequest(sessionId, RequestParams
.getParams("")), getNyRequest(sessionId, RequestParams.getParams("")), ....);
Single<List<Response<MyResponse>>> zip = Single.zip(singles,
objects -> Stream.of(objects).map(o -> (Response<MyResponse>) o).collect(Collectors.toList()));
編輯: 每 10 分鐘重復(fù)一次:
getRequest(...).repeatWhen(c -> c.delay(10, TimeUnit.MINUTES))
.subscribe();
添加回答
舉報(bào)