2015-09-07 11:44:36 -06:00
|
|
|
|
// com/mindviewinc/util/CollectionData.java
|
2015-06-15 17:47:35 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
|
|
|
|
// A Collection filled with data using a generator object.
|
|
|
|
|
package com.mindviewinc.util;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class CollectionData<T> extends ArrayList<T> {
|
|
|
|
|
public CollectionData(Generator<T> gen, int quantity) {
|
|
|
|
|
for(int i = 0; i < quantity; i++)
|
|
|
|
|
add(gen.next());
|
|
|
|
|
}
|
|
|
|
|
// A generic convenience method:
|
|
|
|
|
public static <T> CollectionData<T>
|
|
|
|
|
list(Generator<T> gen, int quantity) {
|
|
|
|
|
return new CollectionData<>(gen, quantity);
|
|
|
|
|
}
|
2015-09-07 11:44:36 -06:00
|
|
|
|
}
|