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

Stuart Marks smarks at openjdk.org
Wed Jan 18 22:58:27 UTC 2023


On Sun, 15 Jan 2023 07:52:53 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 with a new target base due to a merge or a rebase. The pull request now contains four commits:
> 
>  - Copyright year and @since tag updated
>  - Fixes according to review
>    
>    1. Reduce duplication in tests
>    2. Use JumpableGenerator#copy() instead of create(1) in tests, as according to the spec, seed can be ignored
>    3. Simplify documentation for shuffle(List, Random) to avoid duplication.
>  - Remove Random -> ThreadLocalRandom change
>  - 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface

The CSR still needs to be Approved.

(Yes, unfortunately, Finalized is not a terminal state. It means the _writing of the proposal_ has been finalized and is ready to be evaluated for approval.)

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

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


More information about the core-libs-dev mailing list