You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/30 11:33:37 UTC

[4/5] ignite git commit: IGNITE-2263: F.rand(Object ...) is no longer needed.

IGNITE-2263: F.rand(Object ...) is no longer needed.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8225a413
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8225a413
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8225a413

Branch: refs/heads/ignite-2263
Commit: 8225a41322df31b2740760af11eb5a199003aef1
Parents: cdd8cf1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 13:32:02 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 13:32:02 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/util/lang/GridFunc.java    | 14 --------------
 .../cache/GridCacheLuceneQueryIndexTest.java          |  4 +++-
 2 files changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8225a413/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index a412716..ea7c2f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -553,20 +553,6 @@ public class GridFunc {
     }
 
     /**
-     * Gets random value from given array. This operation
-     * does not iterate through array elements and returns immediately.
-     *
-     * @param c Input collection.
-     * @param <T> Type of the collection.
-     * @return Random value from the input collection.
-     */
-    public static <T> T rand(T... c) {
-        A.notNull(c, "c");
-
-        return c[ThreadLocalRandom8.current().nextInt(c.length)];
-    }
-
-    /**
      * Concatenates an element to a collection. If {@code copy} flag is {@code true}, then
      * a new collection will be created and the element and passed in collection will be
      * copied into the new one. The returned collection will be modifiable. If {@code copy}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8225a413/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
index 59a3eca..1e868b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
@@ -335,7 +336,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest {
                             map = new HashMap<>();
                         }
 
-                        map.put(new ObjectKey(String.valueOf(i)), F.rand(vals));
+                        map.put(new ObjectKey(String.valueOf(i)),
+                            vals[ThreadLocalRandom.current().nextInt(vals.length)]);
                     }
 
                     if (!map.isEmpty()) {