(C coll, Supplier<T> gen, int n)
| 18 | } |
| 19 | // Fill an existing collection: |
| 20 | public static <T, C extends Collection<T>> |
| 21 | C fill(C coll, Supplier<T> gen, int n) { |
| 22 | Stream.generate(gen) |
| 23 | .limit(n) |
| 24 | .forEach(coll::add); |
| 25 | return coll; |
| 26 | } |
| 27 | // Use an unbound method reference to |
| 28 | // produce a more general method: |
| 29 | public static <H, A> H fill(H holder, |