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

Method create

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

Source from the content-addressed store, hash-verified

11public class Suppliers {
12 // Create a collection and fill it:
13 public static <T, C extends Collection<T>> C
14 create(Supplier<C> factory, Supplier<T> gen, int n) {
15 return Stream.generate(gen)
16 .limit(n)
17 .collect(factory, C::add, C::addAll);
18 }
19 // Fill an existing collection:
20 public static <T, C extends Collection<T>>
21 C fill(C coll, Supplier<T> gen, int n) {

Callers 4

mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95

Calls

no outgoing calls

Tested by 2

mainMethod · 0.76
mainMethod · 0.76