MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / fill

Method fill

onjava/Suppliers.java:20–26  ·  view source on GitHub ↗
(C coll, Supplier<T> gen, int n)

Source from the content-addressed store, hash-verified

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,

Callers 7

mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
FilledListMethod · 0.95
mainMethod · 0.95
ShelfMethod · 0.95
Foo2Method · 0.95

Calls 1

acceptMethod · 0.65

Tested by 2

mainMethod · 0.76
mainMethod · 0.76