You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/12/09 21:26:35 UTC
[groovy] branch master updated: GROOVY-9331: shuffled() DGM method
shuffles wrong list
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new e0711e6 GROOVY-9331: shuffled() DGM method shuffles wrong list
e0711e6 is described below
commit e0711e6c8b001d17dc2c4998d0882fa935bd60fa
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Dec 10 07:26:02 2019 +1000
GROOVY-9331: shuffled() DGM method shuffles wrong list
---
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index ea986f4..b398ba7 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -12121,7 +12121,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
*/
public static <T> List<T> shuffled(List<T> self) {
List<T> copy = new ArrayList(self);
- Collections.shuffle(self);
+ Collections.shuffle(copy);
return copy;
}
@@ -12142,7 +12142,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
*/
public static <T> List<T> shuffled(List<T> self, Random rnd) {
List<T> copy = new ArrayList(self);
- Collections.shuffle(self, rnd);
+ Collections.shuffle(copy, rnd);
return copy;
}