T - type of items in the collection being sampledpublic interface CollectionSampler<T>
| Modifier and Type | Method and Description |
|---|---|
List<T> |
sample(int nItems)
Samples
nItems items from the collection set by
setCollection(Collection), returning a new collection with the
given samples. |
void |
setCollection(Collection<? extends T> collection)
Set the items to sample from.
|
void setCollection(Collection<? extends T> collection)
collection - the items to sample fromList<T> sample(int nItems)
nItems items from the collection set by
setCollection(Collection), returning a new collection with the
given samples. Implementations can decide what to do if
nItems is bigger than the number of items in the collection.nItems - the number of items to samplenull if a sample cannot be made
for any reason.