On Sat, 8 Oct 2022 15:35:14 GMT, Tagir F. Valeev <tval...@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: > > Remove Random -> ThreadLocalRandom change test/jdk/java/util/Collections/Shuffle.java line 92: > 90: throw new RuntimeException(list.getClass() + ": " + list + " > != " + copy); > 91: } > 92: } Is there a way to factor out the `shuffle` calls and thereby collapse these two methods into one? Is it worth it? I'm thinking you could pass in a `Consumer<List<Integer>>`. ------------- PR: https://git.openjdk.org/jdk/pull/10520