public class ListSamplers extends Object
ListSampler instances.| Modifier and Type | Method and Description |
|---|---|
static ListSampler |
createFull()
Create a
ListSampler where each sample consists of the full list |
static <T> List<List<T>> |
createList(ListSampler listSampler,
List<? extends T> input,
int numSamples)
Create a list consisting of the samples that are provided by the
given
ListSampler when it is applied to the given
input. |
static ListSampler |
createWithAbsoluteSize(int absoluteSampleSize,
Random random)
Create a
ListSampler where each sample consists of a random
sample of the input list. |
static ListSampler |
createWithRelativeSize(double relativeSampleSize,
Random random)
Create a
ListSampler where each sample consists of a random
sample of the input list. |
public static <T> List<List<T>> createList(ListSampler listSampler, List<? extends T> input, int numSamples)
ListSampler when it is applied to the given
input.ListSampler cannot provide the
requested number, the resulting list may contain fewer elements.T - The type of the elementslistSampler - The ListSamplerinput - The inputnumSamples - The number of samplespublic static ListSampler createFull()
ListSampler where each sample consists of the full listListSamplerpublic static ListSampler createWithRelativeSize(double relativeSampleSize, Random random)
ListSampler where each sample consists of a random
sample of the input list. The size of each sample will
be ceil(input.size() * relativeSampleSize).relativeSampleSize - The relative sample sizerandom - The random number generatorListSamplerIllegalArgumentException - If the relative sample size is not
in (0.0, 1.0].public static ListSampler createWithAbsoluteSize(int absoluteSampleSize, Random random)
ListSampler where each sample consists of a random
sample of the input list. Each sample will have at most
the given absolute size. If the resulting sampler is applied to
a list that has a size that is smaller than the given sample size,
then the full list will be returned.absoluteSampleSize - The absolute sample sizerandom - The random number generatorListSamplerIllegalArgumentException - If the sample size is not positiveCopyright © 2018. All rights reserved.