|
/** |
|
* Returns multiple random elements from the specified collection. |
|
* |
|
* @param toSampleFrom the population of the elements you'd like to get a random value from |
|
* @return 0 or more elements of the specified collection, elements don't repeat |
|
*/ |
|
public static <T> List<T> sampleMultiple(Collection<T> toSampleFrom) { |
|
return sampleMultiple(integer(toSampleFrom.size()), toSampleFrom); |
|
} |
|
|
|
/** |
|
* Returns multiple random elements from the specified collection. |
|
* |
|
* @param toSampleFrom the population of the elements you'd like to get a random value from |
|
* @return a random element from the collection |
|
*/ |
|
public static <T> Set<T> sampleMultiple(Set<T> toSampleFrom) { |
|
return new HashSet<T>(sampleMultiple((Collection<T>) toSampleFrom)); |
|
} |
I think that there 2 errors:
Set<T> sampleMultiple has an incorrect comment "@return a random element from the collection" because it doesn't return an element but a set of elements
List<T> sampleMultiple mentions that "elements don't repeat" but it returns a List that could have duplicates. Perhaps, this is addressed to Set<T> sampleMultiple?
datagen/datagen/src/main/java/io/qala/datagen/RandomShortApi.java
Lines 292 to 310 in 523d000
I think that there 2 errors:
Set<T> sampleMultiplehas an incorrect comment "@return a random element from the collection" because it doesn't return an element but a set of elementsList<T> sampleMultiplementions that "elements don't repeat" but it returns a List that could have duplicates. Perhaps, this is addressed toSet<T> sampleMultiple?