Collections.shuffle to accept RandomGenerator
John Rose
john.r.rose at oracle.com
Wed Oct 5 23:55:47 UTC 2022
On 3 Oct 2022, at 14:32, Stuart Marks wrote:
> …
> The Arrays class does need some attention and probably should be considered separately. It's lacking some other things too, like reverse(). One issue with modifying the Arrays class is providing overloads for some or all of the primitives. We've kind of held off because adding primitive overloads adds to the clutter of an already-cluttered class. There are some functions that support only "common" primitives int/long/double (see Arrays::setAll) which reduces the clutter; but I've missed overloads for certain arrays like byte[].
>
> (I'm not saying not to do this; I'm saying this is more than dropping in a single Arrays::shuffle method.)
FTR, since we are talking about shuffles and other permutations, I’d like to bring up a pet RFE for Arrays:
<https://bugs.openjdk.org/browse/JDK-8265378>
Arrays.sort should provide optional external comparator for int and long arrays
And to round out a story that’s been bubbling in my mind for a while, here is another pet RFE to keep it company:
<https://bugs.openjdk.org/browse/JDK-8294879>
Arrays.sort should be accompanied by permutation vector operations
More information about the core-libs-dev
mailing list