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 10:52:20 UTC

[1/8] ignite git commit: IGNITE-2263: Removed F.copy() method.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2263 ef26b779f -> 59b15072d


IGNITE-2263: Removed F.copy() method.


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

Branch: refs/heads/ignite-2263
Commit: ec563803c43a9a642ebc48acf4bc825914533b1f
Parents: ef26b77
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:19:53 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:19:53 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 15 ++++---
 .../ignite/internal/util/lang/GridFunc.java     | 42 +-------------------
 2 files changed, 10 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ec563803/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 14b5816..6bff560 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2269,16 +2269,19 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         Collection<Object> objs = new ArrayList<>();
 
         if (!F.isEmpty(cfg.getLifecycleBeans()))
-            F.copy(objs, cfg.getLifecycleBeans());
+            Collections.addAll(objs, cfg.getLifecycleBeans());
 
         if (!F.isEmpty(cfg.getSegmentationResolvers()))
-            F.copy(objs, cfg.getSegmentationResolvers());
+            Collections.addAll(objs, cfg.getSegmentationResolvers());
 
-        if (cfg.getConnectorConfiguration() != null)
-            F.copy(objs, cfg.getConnectorConfiguration().getMessageInterceptor(),
-                cfg.getConnectorConfiguration().getSslContextFactory());
+        if (cfg.getConnectorConfiguration() != null) {
+            objs.add(cfg.getConnectorConfiguration().getMessageInterceptor());
+            objs.add(cfg.getConnectorConfiguration().getSslContextFactory());
+        }
 
-        F.copy(objs, cfg.getMarshaller(), cfg.getGridLogger(), cfg.getMBeanServer());
+        objs.add(cfg.getMarshaller());
+        objs.add(cfg.getGridLogger());
+        objs.add(cfg.getMBeanServer());
 
         return objs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec563803/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 72a907b..dc393d7 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
@@ -1794,7 +1794,7 @@ public class GridFunc {
 
             @SuppressWarnings({"unchecked"})
             @Nullable @Override public V1 get(Object key) {
-                if (isAll((K)key, p)) {
+                if (isAll((K) key, p)) {
                     V v = m.get(key);
 
                     if (v != null)
@@ -2850,46 +2850,6 @@ public class GridFunc {
     }
 
     /**
-     * Adds (copies) to given collection all elements in <tt>'from'</tt> array.
-     *
-     * @param to Collection to copy to.
-     * @param from Array to copy from.
-     * @param <T> Type of the free variable for the predicate and type of the collection elements.
-     * @return Collection to copy to.
-     */
-    public static <T> Collection<T> copy(Collection<T> to, T... from) {
-        A.notNull(to, "to", from, "from");
-
-        copy(to, asList(from));
-
-        return to;
-    }
-
-    /**
-     * Adds (copies) to given collection using provided predicates. Element is copied if all
-     * predicates evaluate to {@code true}.
-     *
-     * @param to Collection to copy to.
-     * @param from Collection to copy from.
-     * @param p Optional set of predicates to use for filtration.
-     * @param <T> Type of the free variable for the predicate and type of the collection elements.
-     * @return Collection to copy to.
-     */
-    public static <T> Collection<T> copy(Collection<T> to, Iterable<? extends T> from,
-        @Nullable IgnitePredicate<? super T>... p) {
-        A.notNull(to, "to", from, "from");
-
-        if (!isAlwaysFalse(p)) {
-            for (T t : from) {
-                if (isAll(t, p))
-                    to.add(t);
-            }
-        }
-
-        return to;
-    }
-
-    /**
      * Transforms one collection to another using provided closure. New collection will be created.
      *
      * @param c Initial collection to transform.


[2/8] ignite git commit: IGNITE-2263: Removed F.transform(array).

Posted by vo...@apache.org.
IGNITE-2263: Removed F.transform(array).


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

Branch: refs/heads/ignite-2263
Commit: 503be6a569b5392e694653a5e88f7b4dfbda2aae
Parents: ec56380
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:24:21 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:24:21 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/IgniteKernal.java    | 12 ++++++++++--
 .../apache/ignite/internal/util/lang/GridFunc.java  | 15 ---------------
 .../IpcSharedMemoryCrashDetectionSelfTest.java      | 16 ++++++++++------
 3 files changed, 20 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/503be6a5/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 6bff560..7fc0313 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -589,8 +589,16 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Override public List<String> getLifecycleBeansFormatted() {
         LifecycleBean[] beans = cfg.getLifecycleBeans();
 
-        return F.isEmpty(beans) ? Collections.<String>emptyList() :
-            (List<String>)F.transform(beans, F.<LifecycleBean>string());
+        if (F.isEmpty(beans))
+            return Collections.emptyList();
+        else {
+            List<String> res = new ArrayList<>(beans.length);
+
+            for (LifecycleBean bean : beans)
+                res.add(String.valueOf(bean));
+
+            return res;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/503be6a5/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 dc393d7..4a62f1f 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
@@ -2883,21 +2883,6 @@ public class GridFunc {
     }
 
     /**
-     * Transforms an array to read only collection using provided closure.
-     *
-     * @param c Initial array to transform.
-     * @param f Closure to use for transformation.
-     * @param <X> Type of the free variable for the closure and type of the array elements.
-     * @param <Y> Type of the closure's return value.
-     * @return Transformed read only collection.
-     */
-    public static <X, Y> Collection<Y> transform(X[] c, IgniteClosure<? super X, Y> f) {
-        A.notNull(c, "c", f, "f");
-
-        return viewReadOnly(asList(c), f);
-    }
-
-    /**
      * Tests if all provided predicates evaluate to {@code true} for given value. Note that
      * evaluation will be short-circuit when first predicate evaluated to {@code false} is found.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/503be6a5/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
index 1aae999..3482fd6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
@@ -517,12 +517,16 @@ public class IpcSharedMemoryCrashDetectionSelfTest extends GridCommonAbstractTes
          * @param shmemIds Shared memory IDs string.
          */
         public void shmemIds(String shmemIds) {
-            this.shmemIds = (shmemIds == null) ? null :
-                F.transform(shmemIds.split(","), new C1<String, Integer>() {
-                    @Override public Integer apply(String s) {
-                        return Long.valueOf(s).intValue();
-                    }
-                });
+            if (shmemIds == null)
+                this.shmemIds = null;
+            else {
+                String[] tokens = shmemIds.split(",");
+
+                this.shmemIds = new ArrayList<>(tokens.length);
+
+                for (String token : tokens)
+                    this.shmemIds.add(Long.valueOf(token).intValue());
+            }
         }
     }
 }
\ No newline at end of file


[4/8] ignite git commit: IGNITE-2263: Further simplification.

Posted by vo...@apache.org.
IGNITE-2263: Further simplification.


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

Branch: refs/heads/ignite-2263
Commit: 2d550b538e3d83ae72d681e9521a6d548b2dae18
Parents: c7c8efd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:33:09 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:33:09 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/lang/GridFunc.java     | 26 +++++---------------
 1 file changed, 6 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2d550b53/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 abacf85..65c985b 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
@@ -2658,27 +2658,13 @@ public class GridFunc {
      */
     @SuppressWarnings("unchecked")
     public static <T, C extends Collection<T>> C addAll(C c, Iterable<? extends T> it) {
-        if (it == null)
-            return c;
-
-        if (it instanceof Collection<?>) {
-            c.addAll((Collection<? extends T>)it);
-
-            return c;
-        }
-
-        return addAll(c, it.iterator());
-    }
-
-    /**
-     * @param c Target collection.
-     * @param it Iterator to fetch.
-     * @return Modified target collection.
-     */
-    public static <T, C extends Collection<T>> C addAll(C c, Iterator<? extends T> it) {
         if (it != null) {
-            while (it.hasNext())
-                c.add(it.next());
+            if (it instanceof Collection<?>)
+                c.addAll((Collection<? extends T>)it);
+            else {
+                for (T item : it)
+                    c.add(item);
+            }
         }
 
         return c;


[7/8] ignite git commit: IGNITE-2263: Reworked "F.emptyIterator()" routine.

Posted by vo...@apache.org.
IGNITE-2263: Reworked "F.emptyIterator()" routine.


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

Branch: refs/heads/ignite-2263
Commit: 024bead1408003e2b13c65c63d886c4df49c4252
Parents: 94cf22b
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:50:45 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:50:45 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheSwapManager.java       | 7 +++----
 .../ignite/internal/processors/cache/IgniteCacheProxy.java    | 4 ++--
 .../java/org/apache/ignite/internal/util/lang/GridFunc.java   | 6 ++++--
 .../internal/processors/query/h2/opt/GridH2TreeIndex.java     | 4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 37b5e15..4490f63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -42,7 +42,6 @@ import org.apache.ignite.internal.processors.offheap.GridOffHeapProcessor;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.GridWeakIterator;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridTuple;
@@ -1581,7 +1580,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      */
     public <K, V> Iterator<Map.Entry<K, V>> lazySwapIterator() throws IgniteCheckedException {
         if (!swapEnabled)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         return lazyIterator(cctx.gridSwap().rawIterator(spaceName));
     }
@@ -1672,7 +1671,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     private <K, V> Iterator<Map.Entry<K, V>> lazyIterator(
         final GridCloseableIterator<? extends Map.Entry<byte[], byte[]>> it) {
         if (it == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         checkIteratorQueue();
 
@@ -1743,7 +1742,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     private Iterator<KeyCacheObject> keyIterator(
         final GridCloseableIterator<? extends Map.Entry<byte[], byte[]>> it) {
         if (it == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         checkIteratorQueue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 27a7587..a6e0ea8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.processors.cache.query.CacheQuery;
 import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.future.IgniteFutureImpl;
 import org.apache.ignite.internal.util.lang.GridClosureException;
 import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
@@ -77,6 +76,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CX1;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -579,7 +579,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
 
             return new QueryCursor<Cache.Entry<K, V>>() {
                 @Override public Iterator<Cache.Entry<K, V>> iterator() {
-                    return cur != null ? cur.iterator() : new GridEmptyIterator<Cache.Entry<K, V>>();
+                    return cur != null ? cur.iterator() : F.<Cache.Entry<K, V>>emptyIterator();
                 }
 
                 @Override public List<Cache.Entry<K, V>> getAll() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/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 47c90c3..9592e19 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
@@ -37,7 +37,6 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.cache.Cache;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.internal.util.F0;
@@ -226,6 +225,9 @@ public class GridFunc {
         }
     };
 
+    /** Empty iterator. */
+    private static final GridEmptyIterator EMPTY_ITER = new GridEmptyIterator();
+
     /**
      * Gets predicate that evaluates to {@code true} only for given local node ID.
      *
@@ -1153,7 +1155,7 @@ public class GridFunc {
      * @return Newly created empty iterator.
      */
     public static <T> GridIterator<T> emptyIterator() {
-        return new GridEmptyIterator<>();
+        return EMPTY_ITER;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 28adeee..9582df0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -24,10 +24,10 @@ import java.util.Iterator;
 import java.util.NavigableMap;
 import java.util.concurrent.ConcurrentNavigableMap;
 import java.util.concurrent.ConcurrentSkipListMap;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSnapTreeMap;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard;
 import org.apache.ignite.internal.util.snaptree.SnapTreeMap;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
@@ -319,7 +319,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
             comparable(last, 1));
 
         if (range == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         return filter(range.values().iterator());
     }


[6/8] ignite git commit: IGNITE-2263: Moved cache-related methods to GridCacheUtils.

Posted by vo...@apache.org.
IGNITE-2263: Moved cache-related methods to GridCacheUtils.


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

Branch: refs/heads/ignite-2263
Commit: 94cf22b3fdd140a85b239a1e3a5e335d995b1ebb
Parents: 5f780be
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:46:45 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:46:45 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheKeySet.java       |  2 +-
 .../processors/cache/GridCacheUtils.java        | 72 +++++++++++++++++++
 .../cache/GridCacheValueCollection.java         |  5 +-
 .../distributed/near/GridNearCacheAdapter.java  |  3 +-
 .../ignite/internal/util/lang/GridFunc.java     | 75 +-------------------
 5 files changed, 79 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/94cf22b3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheKeySet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheKeySet.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheKeySet.java
index 6d18b7d..af0c704 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheKeySet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheKeySet.java
@@ -66,7 +66,7 @@ public class GridCacheKeySet<K, V> extends GridSerializableSet<K> {
 
     /** {@inheritDoc} */
     @Override public Iterator<K> iterator() {
-        return new GridCacheIterator<>(ctx, map.values(), F.<K, V>cacheEntry2Key(), filter);
+        return new GridCacheIterator<>(ctx, map.values(), CU.<K, V>cacheEntry2Key(), filter);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/94cf22b3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index ff07ac5..b7baf7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -286,6 +286,41 @@ public class GridCacheUtils {
         }
     };
 
+    /** */
+    private static final IgniteClosure CACHE_ENTRY_KEY = new IgniteClosure() {
+        @Override public Object apply(Object o) {
+            return ((Cache.Entry)o).getKey();
+        }
+
+        @Override public String toString() {
+            return "Map entry to key transformer closure.";
+        }
+    };
+
+    /** */
+    private static final IgniteClosure CACHE_ENTRY_VAL_GET = new IgniteClosure() {
+        @SuppressWarnings({"unchecked"})
+        @Nullable @Override public Object apply(Object o) {
+            return ((Cache.Entry)o).getValue();
+        }
+
+        @Override public String toString() {
+            return "Cache entry to get-value transformer closure.";
+        }
+    };
+
+    /** */
+    private static final IgnitePredicate CACHE_ENTRY_HAS_PEEK_VAL = new IgnitePredicate() {
+        @SuppressWarnings({"unchecked"})
+        @Override public boolean apply(Object o) {
+            return ((Cache.Entry)o).getValue() != null;
+        }
+
+        @Override public String toString() {
+            return "Cache entry has-peek-value predicate.";
+        }
+    };
+
     /**
      * Ensure singleton.
      */
@@ -1883,4 +1918,41 @@ public class GridCacheUtils {
                 }
             });
     }
+
+    /**
+     * Gets closure that returns key for cache entry. The closure internally
+     * delegates to {@link javax.cache.Cache.Entry#getKey()} method.
+     *
+     * @param <K> Key type.
+     * @return Closure that returns key for an entry.
+     */
+    @SuppressWarnings({"unchecked"})
+    public static <K, V> IgniteClosure<Cache.Entry<K, V>, K> cacheEntry2Key() {
+        return (IgniteClosure<Cache.Entry<K, V>, K>)CACHE_ENTRY_KEY;
+    }
+
+    /**
+     * Gets closure that returns value for an entry. The closure internally
+     * delegates to {@link javax.cache.Cache.Entry#get(Object)} method.
+     *
+     * @param <K> Key type.
+     * @param <V> Value type.
+     * @return Closure that returns value for an entry.
+     */
+    @SuppressWarnings({"unchecked"})
+    public static <K, V> IgniteClosure<Cache.Entry<K, V>, V> cacheEntry2Get() {
+        return (IgniteClosure<Cache.Entry<K, V>, V>)CACHE_ENTRY_VAL_GET;
+    }
+
+    /**
+     * Gets predicate which returns {@code true} if entry has peek value.
+     *
+     * @param <K> Cache key type.
+     * @param <V> Cache value type.
+     * @return Predicate which returns {@code true} if entry has peek value.
+     */
+    @SuppressWarnings({"unchecked"})
+    public static <K, V> IgnitePredicate<Cache.Entry<K, V>> cacheHasPeekValue() {
+        return (IgnitePredicate<Cache.Entry<K, V>>)CACHE_ENTRY_HAS_PEEK_VAL;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/94cf22b3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueCollection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueCollection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueCollection.java
index 2d1686e..68b54b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueCollection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueCollection.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridSerializableCollection;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.jetbrains.annotations.Nullable;
 
@@ -72,8 +73,8 @@ public class GridCacheValueCollection<K, V> extends GridSerializableCollection<V
         return new GridCacheIterator<K, V, V>(
             ctx,
             map.values(),
-            F.<K, V>cacheEntry2Get(),
-            ctx.vararg(F0.and(filter, F.<K, V>cacheHasPeekValue()))
+            CU.<K, V>cacheEntry2Get(),
+            ctx.vararg(F0.and(filter, CU.<K, V>cacheHasPeekValue()))
         ) {
             {
                 advance();

http://git-wip-us.apache.org/repos/asf/ignite/blob/94cf22b3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 5bf18d9..ce17d03 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.jetbrains.annotations.NotNull;
@@ -416,7 +417,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public Collection<V> values(CacheEntryPredicate... filter) {
-        return new GridCacheValueCollection<>(ctx, entrySet(filter), ctx.vararg(F.<K, V>cacheHasPeekValue()));
+        return new GridCacheValueCollection<>(ctx, entrySet(filter), ctx.vararg(CU.<K, V>cacheHasPeekValue()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/94cf22b3/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 58b9a91..47c90c3 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
@@ -194,42 +194,6 @@ public class GridFunc {
     };
 
     /** */
-    private static final IgniteClosure CACHE_ENTRY_KEY = new IgniteClosure() {
-        @Override public Object apply(Object o) {
-            return ((Cache.Entry)o).getKey();
-        }
-
-        @Override public String toString() {
-            return "Map entry to key transformer closure.";
-        }
-    };
-
-
-    /** */
-    private static final IgniteClosure CACHE_ENTRY_VAL_GET = new IgniteClosure() {
-        @SuppressWarnings({"unchecked"})
-        @Nullable @Override public Object apply(Object o) {
-            return ((Cache.Entry)o).getValue();
-        }
-
-        @Override public String toString() {
-            return "Cache entry to get-value transformer closure.";
-        }
-    };
-
-    /** */
-    private static final IgnitePredicate CACHE_ENTRY_HAS_PEEK_VAL = new IgnitePredicate() {
-        @SuppressWarnings({"unchecked"})
-        @Override public boolean apply(Object o) {
-            return ((Cache.Entry)o).getValue() != null;
-        }
-
-        @Override public String toString() {
-            return "Cache entry has-peek-value predicate.";
-        }
-    };
-
-    /** */
     private static final IgniteClosure<ClusterNode, UUID> NODE2ID = new IgniteClosure<ClusterNode, UUID>() {
         @Override public UUID apply(ClusterNode n) {
             return n.id();
@@ -3513,7 +3477,7 @@ public class GridFunc {
      * @param <T> Element's type.
      * @return Created set.
      */
-    @SuppressWarnings( {"RedundantTypeArguments"})
+    @SuppressWarnings({"RedundantTypeArguments", "unchecked"})
     public static <T> Set<T> asSet(@Nullable T... t) {
         if (t == null || t.length == 0)
             return Collections.<T>emptySet();
@@ -3781,43 +3745,6 @@ public class GridFunc {
     }
 
     /**
-     * Gets closure that returns key for cache entry. The closure internally
-     * delegates to {@link javax.cache.Cache.Entry#getKey()} method.
-     *
-     * @param <K> Key type.
-     * @return Closure that returns key for an entry.
-     */
-    @SuppressWarnings({"unchecked"})
-    public static <K, V> IgniteClosure<Cache.Entry<K, V>, K> cacheEntry2Key() {
-        return (IgniteClosure<Cache.Entry<K, V>, K>)CACHE_ENTRY_KEY;
-    }
-
-    /**
-     * Gets closure that returns value for an entry. The closure internally
-     * delegates to {@link javax.cache.Cache.Entry#get(Object)} method.
-     *
-     * @param <K> Key type.
-     * @param <V> Value type.
-     * @return Closure that returns value for an entry.
-     */
-    @SuppressWarnings({"unchecked"})
-    public static <K, V> IgniteClosure<Cache.Entry<K, V>, V> cacheEntry2Get() {
-        return (IgniteClosure<Cache.Entry<K, V>, V>)CACHE_ENTRY_VAL_GET;
-    }
-
-    /**
-     * Gets predicate which returns {@code true} if entry has peek value.
-     *
-     * @param <K> Cache key type.
-     * @param <V> Cache value type.
-     * @return Predicate which returns {@code true} if entry has peek value.
-     */
-    @SuppressWarnings({"unchecked"})
-    public static <K, V> IgnitePredicate<Cache.Entry<K, V>> cacheHasPeekValue() {
-        return (IgnitePredicate<Cache.Entry<K, V>>)CACHE_ENTRY_HAS_PEEK_VAL;
-    }
-
-    /**
      * Shortcut method that creates an instance of {@link GridClosureException}.
      *
      * @param e Exception to wrap.


[5/8] ignite git commit: IGNITE-2263: Added "asList(t1, t2)" method to avoid array creation in common case.

Posted by vo...@apache.org.
IGNITE-2263: Added "asList(t1, t2)" method to avoid array creation in common case.


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

Branch: refs/heads/ignite-2263
Commit: 5f780bee00951aa73e920d339434df6e950e6b8b
Parents: 2d550b5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:40:30 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:40:30 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/util/lang/GridFunc.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5f780bee/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 65c985b..58b9a91 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
@@ -1150,6 +1150,22 @@ public class GridFunc {
     }
 
     /**
+     * Create list containing two elements.
+     *
+     * @param t1 First element.
+     * @param t2 Second element.
+     * @return List.
+     */
+    public static <T> List<T> asList(T t1, T t2) {
+        ArrayList<T> res = new ArrayList<>(2);
+
+        res.add(t1);
+        res.add(t2);
+
+        return res;
+    }
+
+    /**
      * Converts array to {@link List}. Note that resulting list cannot
      * be altered in size, as it it based on the passed in array -
      * only current elements can be changed.
@@ -3463,6 +3479,7 @@ public class GridFunc {
      * @param <T> Element type.
      * @return Array of elements.
      */
+    @SuppressWarnings("unchecked")
     public static <T> T[] asArray(T... t) {
         return t;
     }


[3/8] ignite git commit: IGNITE-2263: Removed F.partition (unused).

Posted by vo...@apache.org.
IGNITE-2263: Removed F.partition (unused).


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

Branch: refs/heads/ignite-2263
Commit: c7c8efd22739ac4707494dd97a1a82b5f7c31c35
Parents: 503be6a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:29:48 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:29:48 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/lang/GridFunc.java     | 29 --------------------
 1 file changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c7c8efd2/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 4a62f1f..abacf85 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
@@ -3058,35 +3058,6 @@ public class GridFunc {
     }
 
     /**
-     * Partitions input collection in two: first containing elements for which given
-     * predicate evaluates to {@code true} - and second containing the elements for which
-     * predicate evaluates to {@code false}.
-     *
-     * @param c Input collection.
-     * @param p Partitioning predicate.
-     * @param <V> Type of the collection elements.
-     * @return Tuple of two collections: first containing elements for which given predicate
-     *      evaluates to {@code true} - and second containing the elements for which predicate
-     *      evaluates to {@code false}.
-     */
-    public static <V> IgniteBiTuple<Collection<V>, Collection<V>> partition(Iterable<? extends V> c,
-        IgnitePredicate<? super V> p) {
-        A.notNull(c, "c", p, "p");
-
-        Collection<V> c1 = new LinkedList<>();
-        Collection<V> c2 = new LinkedList<>();
-
-        for (V v : c) {
-            if (p.apply(v))
-                c1.add(v);
-            else
-                c2.add(v);
-        }
-
-        return t(c1, c2);
-    }
-
-    /**
      * Checks for existence of the element in input collection for which all provided predicates
      * evaluate to {@code true}.
      *


[8/8] ignite git commit: IGNITE-2263: Removed unused "curry" methods.

Posted by vo...@apache.org.
IGNITE-2263: Removed unused "curry" methods.


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

Branch: refs/heads/ignite-2263
Commit: 59b15072d1707d9e363d143f8956f78f146f703f
Parents: 024bead
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 12:51:41 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 12:51:41 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/lang/GridFunc.java     | 33 --------------------
 1 file changed, 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/59b15072/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 9592e19..703991e 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
@@ -1083,39 +1083,6 @@ public class GridFunc {
     }
 
     /**
-     * Curries given closure.
-     *
-     * @param f Closure.
-     * @param e Parameter.
-     * @param <T> Input type.
-     * @param <R> Output type.
-     * @return Curried closure.
-     */
-    public static <T, R> IgniteOutClosure<R> curry(final IgniteClosure<? super T, R> f, final T e) {
-        return new IgniteOutClosure<R>() {
-            @Override public R apply() {
-                return f.apply(e);
-            }
-        };
-    }
-
-    /**
-     * Curries given closure.
-     *
-     * @param f Closure.
-     * @param e Parameter.
-     * @param <T> Input type.
-     * @return Curried closure.
-     */
-    public static <T> GridAbsClosure curry(final IgniteInClosure<? super T> f, final T e) {
-        return new GridAbsClosure() {
-            @Override public void apply() {
-                f.apply(e);
-            }
-        };
-    }
-
-    /**
      * Create list containing two elements.
      *
      * @param t1 First element.