Another fix for Collections.shuffle(). Without this fix, shuffle doesn't actually do anything on non-random-access collections.

This commit is contained in:
Steve Hannah 2015-03-26 11:37:01 -07:00
parent e3775890fa
commit bf1f83da6c

View File

@ -283,7 +283,7 @@ public class TCollections extends TObject {
shuffleRandomAccess(list, rnd); shuffleRandomAccess(list, rnd);
} else { } else {
TList<Object> randomAccess = new TArrayList<>(list); TList<Object> randomAccess = new TArrayList<>(list);
shuffleRandomAccess(list, rnd); shuffleRandomAccess(randomAccess, rnd);
list.clear(); list.clear();
((TList<Object>)list).addAll(randomAccess); ((TList<Object>)list).addAll(randomAccess);
} }