You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2016/05/16 00:23:38 UTC

[math] MATH-1341

Repository: commons-math
Updated Branches:
  refs/heads/feature-MATH-1341 748cb6093 -> 0f9ce497b


MATH-1341

Avoid "unchecked cast" warning.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0f9ce497
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0f9ce497
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0f9ce497

Branch: refs/heads/feature-MATH-1341
Commit: 0f9ce497b0c6841e3aca845336ad095012c41da7
Parents: 748cb60
Author: Gilles <er...@apache.org>
Authored: Mon May 16 02:23:00 2016 +0200
Committer: Gilles <er...@apache.org>
Committed: Mon May 16 02:23:00 2016 +0200

----------------------------------------------------------------------
 src/main/java/org/apache/commons/math4/random/RandomUtils.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/0f9ce497/src/main/java/org/apache/commons/math4/random/RandomUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomUtils.java b/src/main/java/org/apache/commons/math4/random/RandomUtils.java
index e72655a..610b320 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomUtils.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomUtils.java
@@ -479,11 +479,11 @@ public class RandomUtils {
                 throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, k);
             }
 
-            final T[] objects = (T[]) collection.toArray(new Object[len]);
+            final ArrayList<T> objects = new ArrayList<T>(collection);
             final int[] index = nextPermutation(len, k);
             final List<T> result = new ArrayList<T>(k);
             for (int i = 0; i < k; i++) {
-                result.add(objects[index[i]]);
+                result.add(objects.get(index[i]));
             }
 
             return result;