public class ListSampling extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
createSample(List<? extends T> list,
int sampleSize,
Random random)
Creates a random sample from the given list, with the given size.
|
static <T> Stream<List<T>> |
createSamples(List<? extends T> list,
int sampleSize,
Random random)
Creates a stream that provides random samples from the given list,
each having the given size.
|
public static <T> Stream<List<T>> createSamples(List<? extends T> list, int sampleSize, Random random)
T - The type of the elements in the listlist - The input listsampleSize - The sample sizerandom - The random number generatorIllegalArgumentException - If the sample size is not
positive, or the sample size is larger than the list sizepublic static <T> List<T> createSample(List<? extends T> list, int sampleSize, Random random)
T - The type of the elements in the listlist - The listsampleSize - The size of the samplerandom - The random number generatorIllegalArgumentException - If the sample size is negative or
larger than the list sizeCopyright © 2018. All rights reserved.