I have a Set<Object>
and for each entry in the Set
I have to make an API call passing that as a param. And I have to process each of those responses & populate another Map with some own logic
Sample sequential execution:
List<MyResponse> responses = newArrayList<>();
Set<StoreNode> nodes = // Assume we have a Set
nodes.forEach(storeNode -> responses.add(myAPI.myMethod(storeNode.getId()));
responses.forEach(response -> processResponse(response, myMap); // This is a common map & I have some custom logic to populate this map
How can I achieve the same using Observables? I wanna make those calls in parallel & populate my common map myMap
I came across map(), flatMap() & zip() but most of the examples I saw were simple ones that didn't make API calls & process their response.