-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
datagen/datagen/src/main/java/io/qala/datagen/RandomShortApi.java
Lines 292 to 310 in 523d000
/** | |
* 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 elementsList<T> sampleMultiple
mentions that "elements don't repeat" but it returns a List that could have duplicates. Perhaps, this is addressed toSet<T> sampleMultiple
?
Metadata
Metadata
Assignees
Labels
No labels