RFR: 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface [v4]
Tagir F. Valeev
tvaleev at openjdk.org
Wed Jan 18 22:09:30 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
Hm... is something still missing?
-------------
PR: https://git.openjdk.org/jdk/pull/10520
More information about the core-libs-dev
mailing list