Created
November 23, 2018 05:15
-
-
Save claudioaltamura/dac3f56e41a77a052c59539cc06fb52e to your computer and use it in GitHub Desktop.
Create a generic array with toArray() and Array.newInstance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, CompletableFuture<JsonNode>> completableFutures = | |
this.createCompletableFutures(myRequest); | |
Collection<CompletableFuture<JsonNode>> values = completableFutures.values(); | |
CompletableFuture<JsonNode>[] completableFuturesArray = | |
values.toArray((CompletableFuture<JsonNode>[])Array.newInstance(CompletableFuture.class,completableFutures.size())); | |
CompletableFuture<Void> combinedFutures = CompletableFuture.allOf(completableFuturesArray); | |
combinedFutures.get(100, TimeUnit.MILLISECONDS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment