RFR: 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface [v5]

Joe Darcy darcy at openjdk.org
Sat Jan 21 18:05:07 UTC 2023


On Sat, 21 Jan 2023 08:26:31 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:

>> Java 17 added RandomGenerator interface. However, existing method Collections.shuffle accepts old java.util.Random class. While since Java 19, it's possible to use Random.from(RandomGenerator) wrapper, it would be more convenient to provide direct overload shuffle(List<?> list, RandomGenerator rnd).
>
> Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   @implSpec added

src/java.base/share/classes/java/util/Collections.java line 464:

> 462:      * position, inclusive.<p>
> 463:      *
> 464:      * @implSpec This method runs in linear time.  If the specified list does 

Please also convert the corresponding paragraph in the
shuffle(List<?> list)
method to be an implSpec tag.

-------------

PR: https://git.openjdk.org/jdk/pull/10520


More information about the core-libs-dev mailing list