MCPcopy Index your code
hub / github.com/ccxt/ccxt / PromiseAll

Method PromiseAll

java/lib/src/main/java/io/github/ccxt/Helpers.java:588–608  ·  view source on GitHub ↗
(Object promisesObj)

Source from the content-addressed store, hash-verified

586 public static CompletableFuture<List<Object>> promiseAll(Object promisesObj) { return PromiseAll(promisesObj); }
587
588 public static CompletableFuture<List<Object>> PromiseAll(Object promisesObj) {
589 List<?> promises = (List<?>) promisesObj;
590 List<CompletableFuture<Object>> futures = new ArrayList<>();
591 for (Object p : promises) {
592 if (p instanceof CompletableFuture) {
593 futures.add((CompletableFuture<Object>) p);
594 }
595 }
596 return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
597 .thenApply(v -> {
598 List<Object> out = new ArrayList<>(futures.size());
599 for (CompletableFuture<Object> f : futures) {
600 try {
601 out.add(f.get());
602 } catch (InterruptedException | ExecutionException e) {
603 throw new RuntimeException(e);
604 }
605 }
606 return out;
607 });
608 }
609
610 public static Object toStringOrNull(Object value) {
611 if (value == null) return null;

Callers 4

promiseAllMethod · 0.95
promiseAllFunction · 0.80
LoadPositionsSnapshotMethod · 0.80
LoadPositionsSnapshotMethod · 0.80

Calls 3

addMethod · 0.45
toArrayMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected