()
| 50 | queue = q; |
| 51 | } |
| 52 | @Override public void run() { |
| 53 | rand.ints(10, 0, 20) |
| 54 | .mapToObj(Prioritized::new) |
| 55 | .peek(p -> new Nap(rand.nextDouble() / 10)) |
| 56 | .forEach(p -> queue.add(p)); |
| 57 | queue.add(new Prioritized.EndSentinel()); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | class Consumer implements Runnable { |