Skip to content

Instantly share code, notes, and snippets.

@pvllnspk
Last active January 7, 2018 21:05
Show Gist options
  • Select an option

  • Save pvllnspk/45e9f51150a62b5252656f3e2d806be4 to your computer and use it in GitHub Desktop.

Select an option

Save pvllnspk/45e9f51150a62b5252656f3e2d806be4 to your computer and use it in GitHub Desktop.
1.
for(int i = 0; i < threads.size(); i++) {
threads.get(i).start();
threads.get(i).join();
}
2.
String result = executorService.submit(callable).get();
List<Callable<String>> callables = ...
List<Future<String>> results = executorService.invokeAll(callables);
for(Future<String> future: results){
result+= future.get();
}
for (int i = 0; i < n; ++i) {
Future<String> result = executorCompletionService.take();
}
3.
Observable.zip( , ,new BiFunction() {
@Override
public List<User> apply() throws Exception {
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getObserver());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment