Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < 10000; i++) {
- final int counter = i;
- CompletableFuture.supplyAsync(() -> {
- System.out.println("Looking up " + counter + " on thread " + Thread.currentThread().getName());
- return null;
- });
- }
- Looking up 0 on thread Thread-2
- Looking up 1 on thread Thread-3
- Looking up 2 on thread Thread-4
- ...
- Looking up 10000 on thread Thread-10002
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement