OnJava8-Examples/containers/CollectionDataGeneration.java
2015-05-05 11:20:13 -07:00

19 lines
672 B
Java

//: containers/CollectionDataGeneration.java
// Using the Generators defined in the Arrays chapter.
import java.util.*;
import net.mindview.util.*;
public class CollectionDataGeneration {
public static void main(String[] args) {
System.out.println(new ArrayList<>(
CollectionData.list( // Convenience method
new RandomGenerator.String(9), 10)));
System.out.println(new HashSet<>(
new CollectionData<>(
new RandomGenerator.Integer(), 10)));
}
} /* Output:
[YNzbrnyGc, FOWZnTcQr, GseGZMmJM, RoEsuEcUO, neOEdLsmw, HLGEahKcx, rEqUCBbkI, naMesbtWH, kjUrUkZPg, wsqPzDyCy]
[2017, 3455, 4779, 871, 6090, 573, 7882, 299, 8037, 4367]
*///:~