datagen icon indicating copy to clipboard operation
datagen copied to clipboard

sampleMultiple: possible incorrect javadoc comments

Open php-coder opened this issue 8 years ago • 1 comments

https://github.com/qala-io/datagen/blob/523d0007a339ff8f7e4453c3ffcd063f4dfced6f/datagen/src/main/java/io/qala/datagen/RandomShortApi.java#L292-L310

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?

php-coder avatar Nov 06 '17 22:11 php-coder

List<T> sampleMultiple mentions that "elements don't repeat" but it returns a List that could have duplicates.

Are you saying that the result can have duplicates because the input may have duplicates? We can fix JavaDocs in that case to be clearer. The idea of the method is that it doesn't return same element twice (as opposed to sampling with replacement).

ctapobep avatar Nov 08 '17 08:11 ctapobep