Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. for (int i = 0; i < 10000; i++) {
  2. final int counter = i;
  3. CompletableFuture.supplyAsync(() -> {
  4.  
  5. System.out.println("Looking up " + counter + " on thread " + Thread.currentThread().getName());
  6. return null;
  7. });
  8. }
  9.  
  10. Looking up 0 on thread Thread-2
  11. Looking up 1 on thread Thread-3
  12. Looking up 2 on thread Thread-4
  13. ...
  14. Looking up 10000 on thread Thread-10002
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement