by teh64 · 4y ago · 0 comments
For the second one, you can use an implementation of ExecutorService[1], which has the methods invokeAll and invokeAny.
Futures in Java are similar to Promises in Javascript, in that they represent a calculation that might not be completed yet.
1. https://docs.oracle.com/en/java/javase/17/docs/api/java.base... 2. https://docs.oracle.com/en/java/javase/17/docs/api/java.base...
`ExecutorService#submit` works with the latter.