ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [44/50] [abbrv] ignite git commit: Revert "IGNITE-2330: Simplified GridFunc."
Date Mon, 11 Jan 2016 05:58:14 GMT
Revert "IGNITE-2330: Simplified GridFunc."

This reverts commit 80579253febd6389dbb3a84706671cc8083df1f2.


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

Branch: refs/heads/ignite-1537
Commit: ddbe2d596e5aaf0b04a26c584dfe2ca8a664c570
Parents: cd5cd2e
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Sun Jan 3 23:49:09 2016 +0400
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Sun Jan 3 23:49:09 2016 +0400

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |   27 +-
 .../internal/cluster/ClusterGroupAdapter.java   |   10 +-
 .../discovery/GridDiscoveryManager.java         |   19 +-
 .../loadbalancer/GridLoadBalancerManager.java   |    8 +-
 .../processors/cache/GridCacheAdapter.java      |   14 +-
 .../processors/cache/GridCacheContext.java      |    3 +-
 .../cache/GridCacheEvictionManager.java         |    5 +-
 .../processors/cache/GridCacheIoManager.java    |    5 +-
 .../processors/cache/GridCacheIterator.java     |    4 +-
 .../processors/cache/GridCacheKeySet.java       |    2 +-
 .../GridCachePartitionExchangeManager.java      |   12 +-
 .../processors/cache/GridCacheProcessor.java    |    9 +-
 .../processors/cache/GridCacheSwapManager.java  |    7 +-
 .../processors/cache/GridCacheUtils.java        |   92 -
 .../cache/GridCacheValueCollection.java         |    5 +-
 .../processors/cache/IgniteCacheProxy.java      |    4 +-
 .../dht/GridClientPartitionTopology.java        |    3 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |    3 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |    3 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |    3 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |    5 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   21 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |    8 +-
 .../distributed/near/GridNearCacheAdapter.java  |   11 +-
 .../local/atomic/GridLocalAtomicCache.java      |   17 +-
 .../GridCacheAtomicStampedImpl.java             |    5 +-
 .../internal/processors/igfs/IgfsProcessor.java |    8 +-
 .../dotnet/PlatformDotNetCacheStore.java        |    4 +-
 .../top/GridTopologyCommandHandler.java         |    3 +-
 .../org/apache/ignite/internal/util/F0.java     |  325 +++-
 .../internal/util/GridExecutionStatistics.java  |    4 +-
 .../ignite/internal/util/IgniteUtils.java       |    4 +-
 .../ignite/internal/util/lang/GridFunc.java     | 1764 ++++++++++++++----
 .../ignite/internal/util/lang/GridTuple3.java   |    1 +
 .../ignite/internal/util/lang/GridTuple4.java   |    1 +
 .../ignite/internal/util/lang/GridTuple5.java   |    1 +
 .../ignite/internal/util/lang/GridTuple6.java   |    1 +
 .../ignite/internal/util/lang/GridTupleV.java   |    1 +
 .../java/org/apache/ignite/lang/IgniteUuid.java |    2 +-
 .../memory/MemoryEventStorageSpi.java           |    1 -
 .../cache/GridCacheLuceneQueryIndexTest.java    |    4 +-
 .../distributed/GridCacheEventAbstractTest.java |    2 +-
 .../IpcSharedMemoryCrashDetectionSelfTest.java  |   16 +-
 .../ignite/lang/GridBasicPerformanceTest.java   |   10 +-
 .../ignite/lang/GridFuncPerformanceTest.java    |  102 +
 .../ignite/loadtest/GridLoadTestStatistics.java |    2 +-
 .../query/h2/opt/GridH2TreeIndex.java           |    4 +-
 47 files changed, 1988 insertions(+), 577 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 7fc0313..14b5816 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,16 +589,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Override public List<String> getLifecycleBeansFormatted() {
         LifecycleBean[] beans = cfg.getLifecycleBeans();
 
-        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;
-        }
+        return F.isEmpty(beans) ? Collections.<String>emptyList() :
+            (List<String>)F.transform(beans, F.<LifecycleBean>string());
     }
 
     /**
@@ -2277,19 +2269,16 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         Collection<Object> objs = new ArrayList<>();
 
         if (!F.isEmpty(cfg.getLifecycleBeans()))
-            Collections.addAll(objs, cfg.getLifecycleBeans());
+            F.copy(objs, cfg.getLifecycleBeans());
 
         if (!F.isEmpty(cfg.getSegmentationResolvers()))
-            Collections.addAll(objs, cfg.getSegmentationResolvers());
+            F.copy(objs, cfg.getSegmentationResolvers());
 
-        if (cfg.getConnectorConfiguration() != null) {
-            objs.add(cfg.getConnectorConfiguration().getMessageInterceptor());
-            objs.add(cfg.getConnectorConfiguration().getSslContextFactory());
-        }
+        if (cfg.getConnectorConfiguration() != null)
+            F.copy(objs, cfg.getConnectorConfiguration().getMessageInterceptor(),
+                cfg.getConnectorConfiguration().getSslContextFactory());
 
-        objs.add(cfg.getMarshaller());
-        objs.add(cfg.getGridLogger());
-        objs.add(cfg.getMBeanServer());
+        F.copy(objs, cfg.getMarshaller(), cfg.getGridLogger(), cfg.getMBeanServer());
 
         return objs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index a153b83..75168a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -51,7 +51,6 @@ import org.apache.ignite.internal.IgniteServicesImpl;
 import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.executor.GridExecutorService;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.util.lang.GridNodePredicate;
 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.U;
@@ -368,7 +367,8 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
         guard();
 
         try {
-            ctx.resource().injectGeneric(p);
+            if (p != null)
+                ctx.resource().injectGeneric(p);
 
             return new ClusterGroupAdapter(ctx, subjId, this.p != null ? F.and(p, this.p) : p);
         }
@@ -703,7 +703,6 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         gridName = U.readString(in);
         subjId = U.readUuid(in);
@@ -920,7 +919,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
 
                 ClusterNode node = isOldest ? U.oldest(super.nodes(), null) : U.youngest(super.nodes(), null);
 
-                IgnitePredicate<ClusterNode> p = new GridNodePredicate(node);
+                IgnitePredicate<ClusterNode> p = F.nodeForNodes(node);
 
                 state = new AgeClusterGroupState(node, p, lastTopVer);
             }
@@ -962,7 +961,8 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
             guard();
 
             try {
-                ctx.resource().injectGeneric(p);
+                if (p != null)
+                    ctx.resource().injectGeneric(p);
 
                 return new ClusterGroupAdapter(ctx, this.subjId, new GroupPredicate(this, p));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 844fd0f..72a2bef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -30,6 +30,7 @@ import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -78,6 +79,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.jobmetrics.GridJobMetrics;
 import org.apache.ignite.internal.processors.security.SecurityContext;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -1315,26 +1317,13 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
     }
 
     /**
-     * Gets collection of node for given node IDs.
-     *
-     * @param ids Ids to include.
-     * @return Collection with all alive nodes for given IDs.
-     */
-    public Collection<ClusterNode> nodes(@Nullable Collection<UUID> ids) {
-        return F.isEmpty(ids) ? Collections.<ClusterNode>emptyList() :
-            F.view(
-                F.viewReadOnly(ids, U.id2Node(ctx)),
-                F.notNull());
-    }
-
-    /**
      * Gets collection of node for given node IDs and predicates.
      *
      * @param ids Ids to include.
      * @param p Filter for IDs.
      * @return Collection with all alive nodes for given IDs.
      */
-    public Collection<ClusterNode> nodes(@Nullable Collection<UUID> ids, IgnitePredicate<UUID> p) {
+    public Collection<ClusterNode> nodes(@Nullable Collection<UUID> ids, IgnitePredicate<UUID>... p) {
         return F.isEmpty(ids) ? Collections.<ClusterNode>emptyList() :
             F.view(
                 F.viewReadOnly(ids, U.id2Node(ctx), p),
@@ -2576,7 +2565,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             nearEnabledCaches = Collections.unmodifiableSet(nearEnabledSet);
 
             daemonNodes = Collections.unmodifiableList(new ArrayList<>(
-                F.view(F.concat(false, loc, rmts), F.not(daemonFilter))));
+                F.view(F.concat(false, loc, rmts), F0.not(daemonFilter))));
 
             Map<UUID, ClusterNode> nodeMap = new HashMap<>(allNodes().size() + daemonNodes.size(), 1.0f);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/managers/loadbalancer/GridLoadBalancerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/loadbalancer/GridLoadBalancerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/loadbalancer/GridLoadBalancerManager.java
index efe09b0..631168b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/loadbalancer/GridLoadBalancerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/loadbalancer/GridLoadBalancerManager.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.managers.loadbalancer;
 
 import java.util.Collection;
-import java.util.LinkedList;
 import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -93,12 +92,7 @@ public class GridLoadBalancerManager extends GridManagerAdapter<LoadBalancingSpi
                 if (F.isEmpty(exclNodes))
                     return GridLoadBalancerManager.this.getBalancedNode(ses, top, job);
 
-                List<ClusterNode> nodes = new LinkedList<>();
-
-                for (ClusterNode topNode : top) {
-                    if (!exclNodes.contains(topNode))
-                        nodes.add(topNode);
-                }
+                List<ClusterNode> nodes = F.loseList(top, true, exclNodes);
 
                 if (nodes.isEmpty())
                     return null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index a4cf737..5d4c386 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -106,6 +106,7 @@ import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridClosureException;
 import org.apache.ignite.internal.util.lang.GridTriple;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.C2;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CI2;
@@ -2149,7 +2150,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return syncOp(new SyncOp<Map<K, EntryProcessorResult<T>>>(keys.size() == 1) {
             @Nullable @Override public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx)
                 throws IgniteCheckedException {
-                Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = CU.invokeMap(keys, entryProcessor);
+                Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys,
+                    new C1<K, EntryProcessor<K, V, Object>>() {
+                            @Override public EntryProcessor apply(K k) {
+                            return entryProcessor;
+                        }
+                    });
 
                 IgniteInternalFuture<GridCacheReturn> fut = tx.invokeAsync(ctx, invokeMap, args);
 
@@ -2216,7 +2222,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         IgniteInternalFuture<?> fut = asyncOp(new AsyncInOp(keys) {
             @Override public IgniteInternalFuture<GridCacheReturn> inOp(IgniteTxLocalAdapter tx) {
-                Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = CU.invokeMap(keys, entryProcessor);
+                Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor<K, V, Object>>() {
+                    @Override public EntryProcessor apply(K k) {
+                        return entryProcessor;
+                    }
+                });
 
                 return tx.invokeAsync(ctx, invokeMap, args);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index ef49567..c10ebf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -85,6 +85,7 @@ import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.offheap.GridOffHeapProcessor;
 import org.apache.ignite.internal.processors.plugin.CachePluginManager;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.lang.GridFunc;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -1511,7 +1512,7 @@ public class GridCacheContext<K, V> implements Externalizable {
             Collection<ClusterNode> nearNodes = null;
 
             if (!F.isEmpty(readers)) {
-                nearNodes = discovery().nodes(readers, F.notEqualTo(nearNodeId));
+                nearNodes = discovery().nodes(readers, F0.notEqualTo(nearNodeId));
 
                 if (log.isDebugEnabled())
                     log.debug("Mapping entry to near nodes [nodes=" + U.nodeIds(nearNodes) + ", entry=" + entry + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index f542f4b..845e204 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridBusyLock;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridUnsafe;
@@ -1309,7 +1310,7 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
                 try {
                     GridCacheVersion ver = e.version();
 
-                    return info.version().equals(ver) && F.isAll(e, info.filter());
+                    return info.version().equals(ver) && F.isAll(info.filter());
                 }
                 catch (GridCacheEntryRemovedException ignored) {
                     return false;
@@ -1340,7 +1341,7 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
         Collection<ClusterNode> backups;
 
         if (evictSync)
-            backups = F.view(cctx.dht().topology().nodes(entry.partition(), topVer), F.notEqualTo(cctx.localNode()));
+            backups = F.view(cctx.dht().topology().nodes(entry.partition(), topVer), F0.notEqualTo(cctx.localNode()));
         else
             backups = Collections.emptySet();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 4c9cdf2..0aa8b1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPr
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridLeanSet;
 import org.apache.ignite.internal.util.GridSpinReadWriteLock;
 import org.apache.ignite.internal.util.typedef.CI1;
@@ -730,7 +731,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
                 }
 
                 if (added) {
-                    if (!F.exist(F.nodeIds(nodes), F.not(F.contains(leftIds)))) {
+                    if (!F.exist(F.nodeIds(nodes), F0.not(F.contains(leftIds)))) {
                         if (log.isDebugEnabled())
                             log.debug("Message will not be sent because all nodes left topology [msg=" + msg +
                                 ", nodes=" + U.toShortString(nodes) + ']');
@@ -766,7 +767,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
                     U.sleep(retryDelay);
                 }
 
-                if (!F.exist(F.nodeIds(nodes), F.not(F.contains(leftIds)))) {
+                if (!F.exist(F.nodeIds(nodes), F0.not(F.contains(leftIds)))) {
                     if (log.isDebugEnabled())
                         log.debug("Message will not be sent because all nodes left topology [msg=" + msg + ", nodes=" +
                             U.toShortString(nodes) + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
index e4a471c..19da4a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
@@ -19,8 +19,6 @@ package org.apache.ignite.internal.processors.cache;
 
 import java.util.Iterator;
 import javax.cache.Cache;
-
-import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridSerializableIterator;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgniteClosure;
@@ -59,7 +57,7 @@ public class GridCacheIterator<K, V, T> implements GridSerializableIterator<T> {
     ) {
         this.cctx = cctx;
 
-        it = F.identityIterator(c, F0.and(filter));
+        it = F.iterator0(c, false, filter);
 
         this.trans = trans;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 af0c704..6d18b7d 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(), CU.<K, V>cacheEntry2Key(), filter);
+        return new GridCacheIterator<>(ctx, map.values(), F.<K, V>cacheEntry2Key(), filter);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 4732597..a0f7f93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -80,7 +80,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.util.worker.GridWorker;
 import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.thread.IgniteThread;
@@ -1271,16 +1270,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                     }
 
                     // After workers line up and before preloading starts we initialize all futures.
-                    if (log.isDebugEnabled()) {
-                        IgnitePredicate p = new IgnitePredicate<IgniteInternalFuture<?>>() {
-                            @Override public boolean apply(IgniteInternalFuture<?> f) {
-                                return !f.isDone();
-                            }
-                        };
-
+                    if (log.isDebugEnabled())
                         log.debug("Before waiting for exchange futures [futs" +
-                            F.view(exchFuts.values(), p) + ", worker=" + this + ']');
-                    }
+                            F.view(exchFuts.values(), F.unfinishedFutures()) + ", worker=" + this + ']');
 
                     // Take next exchange future.
                     exchFut = poll(futQ, timeout, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index f6fc9d4..ff02e70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -96,6 +96,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
 import org.apache.ignite.internal.processors.plugin.CachePluginManager;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -1159,12 +1160,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 log.debug("Executed onKernalStart() callback for DHT cache: " + dht.name());
         }
 
-        Collection<GridCacheManager> excluded = dhtExcludes(ctx);
-
-        for (GridCacheManager mgr : ctx.managers()) {
-            if (!excluded.contains(mgr))
-                mgr.onKernalStart();
-        }
+        for (GridCacheManager mgr : F.view(ctx.managers(), F0.notContains(dhtExcludes(ctx))))
+            mgr.onKernalStart();
 
         cache.onKernalStart();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 4490f63..37b5e15 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,6 +42,7 @@ 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;
@@ -1580,7 +1581,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      */
     public <K, V> Iterator<Map.Entry<K, V>> lazySwapIterator() throws IgniteCheckedException {
         if (!swapEnabled)
-            return F.emptyIterator();
+            return new GridEmptyIterator<>();
 
         return lazyIterator(cctx.gridSwap().rawIterator(spaceName));
     }
@@ -1671,7 +1672,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 F.emptyIterator();
+            return new GridEmptyIterator<>();
 
         checkIteratorQueue();
 
@@ -1742,7 +1743,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     private Iterator<KeyCacheObject> keyIterator(
         final GridCloseableIterator<? extends Map.Entry<byte[], byte[]>> it) {
         if (it == null)
-            return F.emptyIterator();
+            return new GridEmptyIterator<>();
 
         checkIteratorQueue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 b7baf7e..51f6dcd 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
@@ -43,8 +43,6 @@ import javax.cache.configuration.Factory;
 import javax.cache.expiry.Duration;
 import javax.cache.expiry.ExpiryPolicy;
 import javax.cache.integration.CacheWriterException;
-import javax.cache.processor.EntryProcessor;
-
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
@@ -286,41 +284,6 @@ 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.
      */
@@ -1900,59 +1863,4 @@ public class GridCacheUtils {
 
         return res;
     }
-
-    /**
-     * Create invoke map for the given key set. All provided values will be set to the passed entry processor.
-     *
-     * @param keys Keys.
-     * @param entryProc Entry processor.
-     * @return Invoke map.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V, T> Map<? extends K, EntryProcessor<K, V, Object>> invokeMap(
-        final Set<? extends K> keys, final EntryProcessor<K, V, T> entryProc) {
-        return F.viewAsMap(keys,
-            new C1<K, EntryProcessor<K, V, Object>>() {
-                @Override public EntryProcessor apply(K k) {
-                    return entryProc;
-                }
-            });
-    }
-
-    /**
-     * 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/ddbe2d59/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 68b54b3..2d1686e 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,7 +27,6 @@ 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;
 
@@ -73,8 +72,8 @@ public class GridCacheValueCollection<K, V> extends GridSerializableCollection<V
         return new GridCacheIterator<K, V, V>(
             ctx,
             map.values(),
-            CU.<K, V>cacheEntry2Get(),
-            ctx.vararg(F0.and(filter, CU.<K, V>cacheHasPeekValue()))
+            F.<K, V>cacheEntry2Get(),
+            ctx.vararg(F0.and(filter, F.<K, V>cacheHasPeekValue()))
         ) {
             {
                 advance();

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 a6e0ea8..27a7587 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,6 +69,7 @@ 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;
@@ -76,7 +77,6 @@ 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() : F.<Cache.Entry<K, V>>emptyIterator();
+                    return cur != null ? cur.iterator() : new GridEmptyIterator<Cache.Entry<K, V>>();
                 }
 
                 @Override public List<Cache.Entry<K, V>> getAll() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 9c18ad0..8aef5ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
@@ -697,7 +698,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
 
             // Remove obsolete mappings.
             if (cur != null) {
-                for (Integer p : F.view(cur.keySet(), F.notIn(parts.keySet()))) {
+                for (Integer p : F.view(cur.keySet(), F0.notIn(parts.keySet()))) {
                     Set<UUID> ids = part2node.get(p);
 
                     if (ids != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index cdf0fc2..a0709c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
@@ -1054,7 +1055,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
 
             // Remove obsolete mappings.
             if (cur != null) {
-                for (Integer p : F.view(cur.keySet(), F.notIn(parts.keySet()))) {
+                for (Integer p : F.view(cur.keySet(), F0.notIn(parts.keySet()))) {
                     Set<UUID> ids = part2node.get(p);
 
                     if (ids != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 2b40436..ae24ed1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridLeanSet;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.lang.GridClosureException;
@@ -1381,7 +1382,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
         Collection<ClusterNode> nearNodes = null;
 
         if (!F.isEmpty(readers)) {
-            nearNodes = ctx.discovery().nodes(readers, F.not(F.idForNodeId(nodeId)));
+            nearNodes = ctx.discovery().nodes(readers, F0.not(F.idForNodeId(nodeId)));
 
             if (log.isDebugEnabled())
                 log.debug("Mapping entry to near nodes [nodes=" + U.toShortString(nearNodes) + ", entry=" + cached +

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 1fe3ae2..534a560 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridLeanMap;
 import org.apache.ignite.internal.util.GridLeanSet;
 import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
@@ -640,7 +641,7 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
             // Otherwise, during rollback we will not know whether locks need
             // to be rolled back.
             // Loose all skipped and previously locked (we cannot reenter locks here).
-            final Collection<KeyCacheObject> passedKeys = skipped != null ? F.view(keys, F.notIn(skipped)) : keys;
+            final Collection<KeyCacheObject> passedKeys = skipped != null ? F.view(keys, F0.notIn(skipped)) : keys;
 
             if (log.isDebugEnabled())
                 log.debug("Lock keys: " + passedKeys);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 23fdbf5..d8b2f37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -61,6 +61,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.dr.GridDrType;
 import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridLeanSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -1303,14 +1304,14 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
 
                 if (!F.isEmpty(readers)) {
                     Collection<ClusterNode> nearNodes =
-                        cctx.discovery().nodes(readers, F.not(F.idForNodeId(tx.nearNodeId())));
+                        cctx.discovery().nodes(readers, F0.not(F.idForNodeId(tx.nearNodeId())));
 
                     if (log.isDebugEnabled())
                         log.debug("Mapping entry to near nodes [nodes=" + U.toShortString(nearNodes) +
                             ", entry=" + entry + ']');
 
                     // Exclude DHT nodes.
-                    map(entry, F.view(nearNodes, F.notIn(dhtNodes)), nearMap);
+                    map(entry, F.view(nearNodes, F0.notIn(dhtNodes)), nearMap);
                 }
                 else if (log.isDebugEnabled())
                     log.debug("Entry has no near readers: " + entry);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index e0b108b..393413e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -77,10 +77,12 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSing
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrExpirationInfo;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -410,9 +412,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public IgniteInternalFuture<V> getAndPutAsync0(K key, V val, @Nullable CacheEntryPredicate... filter) {
-        A.notNull(key, "key", val, "val");
+        A.notNull(key, "key");
 
-        return updateAllAsync0(F.asMap(key, val),
+        return updateAllAsync0(F0.asMap(key, val),
             null,
             null,
             null,
@@ -426,9 +428,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable CacheEntryPredicate... filter) {
-        A.notNull(key, "key", val, "val");
+        A.notNull(key, "key");
 
-        return updateAllAsync0(F.asMap(key, val),
+        return updateAllAsync0(F0.asMap(key, val),
             null,
             null,
             null,
@@ -443,7 +445,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     @Override public V tryPutIfAbsent(K key, V val) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");
 
-        return (V)updateAllAsync0(F.asMap(key, val),
+        return (V)updateAllAsync0(F0.asMap(key, val),
             null,
             null,
             null,
@@ -793,13 +795,18 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
-        EntryProcessor<K, V, T> entryProcessor, Object... args) {
+        final EntryProcessor<K, V, T> entryProcessor,
+        Object... args) {
         A.notNull(keys, "keys", entryProcessor, "entryProcessor");
 
         if (keyCheck)
             validateCacheKeys(keys);
 
-        Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = CU.invokeMap(keys, entryProcessor);
+        Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() {
+            @Override public EntryProcessor apply(K k) {
+                return entryProcessor;
+            }
+        });
 
         CacheOperationContext opCtx = ctx.operationContextPerCall();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
index 6b03131..7970a44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridLeanSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -520,11 +521,8 @@ public final class GridDhtForceKeysFuture<K, V> extends GridCompoundFuture<Objec
             if (!cctx.rebalanceEnabled()) {
                 Collection<KeyCacheObject> retryKeys = F.view(
                     keys,
-                    F.and(
-                        F.notIn(missedKeys),
-                        F.notIn(F.viewReadOnly(res.forcedInfos(), CU.<KeyCacheObject, V>info2Key()))
-                    )
-                );
+                    F0.notIn(missedKeys),
+                    F0.notIn(F.viewReadOnly(res.forcedInfos(), CU.<KeyCacheObject, V>info2Key())));
 
                 if (!retryKeys.isEmpty())
                     map(retryKeys, F.concat(false, node, exc));

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/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 5c48dc7..5bf18d9 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,7 +64,6 @@ 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;
@@ -417,7 +416,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(CU.<K, V>cacheHasPeekValue()));
+        return new GridCacheValueCollection<>(ctx, entrySet(filter), ctx.vararg(F.<K, V>cacheHasPeekValue()));
     }
 
     /** {@inheritDoc} */
@@ -559,12 +558,12 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
         /** {@inheritDoc} */
         @NotNull @Override public Iterator<Cache.Entry<K, V>> iterator() {
             return new EntryIterator(nearSet.iterator(),
-                F.identityIterator(dhtSet, new P1<Cache.Entry<K, V>>() {
-                    @Override
-                    public boolean apply(Cache.Entry<K, V> e) {
+                F.iterator0(dhtSet, false, new P1<Cache.Entry<K, V>>() {
+                    @Override public boolean apply(Cache.Entry<K, V> e) {
                         try {
                             return GridNearCacheAdapter.super.localPeek(e.getKey(), NEAR_PEEK_MODE, null) == null;
-                        } catch (IgniteCheckedException ex) {
+                        }
+                        catch (IgniteCheckedException ex) {
                             throw new IgniteException(ex);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 3b60f96..6130ead 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.local.GridLocalCacheEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -188,7 +189,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @Override public IgniteInternalFuture<V> getAndPutAsync0(K key, V val, @Nullable CacheEntryPredicate... filter) {
         A.notNull(key, "key", val, "val");
 
-        return updateAllAsync0(F.asMap(key, val),
+        return updateAllAsync0(F0.asMap(key, val),
             null,
             null,
             true,
@@ -201,7 +202,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
     @Override public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable CacheEntryPredicate... filter) {
         A.notNull(key, "key", val, "val");
 
-        return updateAllAsync0(F.asMap(key, val),
+        return updateAllAsync0(F0.asMap(key, val),
             null,
             null,
             false,
@@ -658,7 +659,11 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         if (keyCheck)
             validateCacheKeys(keys);
 
-        Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = CU.invokeMap(keys, entryProcessor);
+        Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() {
+            @Override public EntryProcessor apply(K k) {
+                return entryProcessor;
+            }
+        });
 
         CacheOperationContext opCtx = ctx.operationContextPerCall();
 
@@ -724,7 +729,11 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         if (keyCheck)
             validateCacheKeys(keys);
 
-        Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = CU.invokeMap(keys, entryProcessor);
+        Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() {
+            @Override public EntryProcessor apply(K k) {
+                return entryProcessor;
+            }
+        });
 
         return updateAllAsync0(null,
             invokeMap,

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
index 84c4269..f7a82a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.util.F0;
 import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -178,8 +179,8 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt
         checkRemoved();
 
         try {
-            return CU.outTx(internalCompareAndSet(F.equalTo(expVal), wrapperClosure(newVal),
-                F.equalTo(expStamp), wrapperClosure(newStamp)), ctx);
+            return CU.outTx(internalCompareAndSet(F0.equalTo(expVal), wrapperClosure(newVal),
+                F0.equalTo(expStamp), wrapperClosure(newStamp)), ctx);
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index b313084..5b8cf86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.IgniteNodeAttributes;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.ipc.IpcServerEndpoint;
 import org.apache.ignite.internal.util.typedef.C1;
+import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -127,8 +128,11 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
 
         final Map<String, CacheConfiguration> cacheCfgs = new HashMap<>();
 
-        for (CacheConfiguration c : gridCfg.getCacheConfiguration())
-            cacheCfgs.put(c.getName(), c);
+        F.forEach(gridCfg.getCacheConfiguration(), new CI1<CacheConfiguration>() {
+            @Override public void apply(CacheConfiguration c) {
+                cacheCfgs.put(c.getName(), c);
+            }
+        });
 
         Collection<IgfsAttributes> attrVals = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
index 9f0fd3f..7e65c22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
@@ -235,13 +235,13 @@ public class PlatformDotNetCacheStore<K, V> implements CacheStore<K, V>, Platfor
                         @Override public Set<Entry<K, V>> entrySet() {
                             return new AbstractSet<Entry<K, V>>() {
                                 @Override public Iterator<Entry<K, V>> iterator() {
-                                    return F.iteratorReadOnly(entries, new C1<Cache.Entry<? extends K, ? extends V>, Entry<K, V>>() {
+                                    return F.iterator(entries, new C1<Cache.Entry<? extends K, ? extends V>, Entry<K, V>>() {
                                         private static final long serialVersionUID = 0L;
 
                                         @Override public Entry<K, V> apply(Cache.Entry<? extends K, ? extends V> entry) {
                                             return new GridMapEntry<>(entry.getKey(), entry.getValue());
                                         }
-                                    });
+                                    }, true);
                                 }
 
                                 @Override public int size() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index 5e12199..297785e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -135,7 +135,8 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
                 }
                 else
                     node = F.find(ctx.discovery().allNodes(), null, new P1<ClusterNode>() {
-                        @Override public boolean apply(ClusterNode n) {
+                        @Override
+                        public boolean apply(ClusterNode n) {
                             return containsIp(n.addresses(), ip);
                         }
                     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
index b819226..7e9e448 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.util;
 
+import java.util.Collection;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
@@ -25,9 +27,11 @@ import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
 import org.apache.ignite.internal.processors.cache.CacheEntrySerializablePredicate;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.util.lang.GridFunc;
 import org.apache.ignite.internal.util.lang.GridNodePredicate;
 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.lang.IgnitePredicate;
 import org.jetbrains.annotations.Nullable;
@@ -38,6 +42,79 @@ import org.jetbrains.annotations.Nullable;
  */
 public class F0 {
     /**
+     * Negates given predicates.
+     * <p>
+     * Gets predicate (not peer-deployable) that evaluates to {@code true} if any of given predicates
+     * evaluates to {@code false}. If all predicates evaluate to {@code true} the
+     * result predicate will evaluate to {@code false}.
+     *
+     * @param p Predicate to negate.
+     * @param <T> Type of the free variable, i.e. the element the predicate is called on.
+     * @return Negated predicate (not peer-deployable).
+     */
+    public static <T> IgnitePredicate<T> not(@Nullable final IgnitePredicate<? super T>... p) {
+        return F.isAlwaysFalse(p) ? F.<T>alwaysTrue() : F.isAlwaysTrue(p) ? F.<T>alwaysFalse() : new P1<T>() {
+            @Override public boolean apply(T t) {
+                return !F.isAll(t, p);
+            }
+        };
+    }
+
+    /**
+     * Gets predicate (not peer-deployable) that evaluates to {@code true} if its free variable is not equal
+     * to {@code target} or both are {@code null}.
+     *
+     * @param target Object to compare free variable to.
+     * @param <T> Type of the free variable, i.e. the element the predicate is called on.
+     * @return Predicate (not peer-deployable) that evaluates to {@code true} if its free variable is not equal
+     *      to {@code target} or both are {@code null}.
+     */
+    public static <T> IgnitePredicate<T> notEqualTo(@Nullable final T target) {
+        return new P1<T>() {
+            @Override public boolean apply(T t) {
+                return !F.eq(t, target);
+            }
+        };
+    }
+
+    /**
+     * Gets predicate (not peer-deployable) that returns {@code true} if its free variable
+     * is not contained in given collection.
+     *
+     * @param c Collection to check for containment.
+     * @param <T> Type of the free variable for the predicate and type of the
+     *      collection elements.
+     * @return Predicate (not peer-deployable) that returns {@code true} if its free variable is not
+     *      contained in given collection.
+     */
+    public static <T> IgnitePredicate<T> notIn(@Nullable final Collection<? extends T> c) {
+        return F.isEmpty(c) ? GridFunc.<T>alwaysTrue() : new P1<T>() {
+            @Override public boolean apply(T t) {
+                assert c != null;
+
+                return !c.contains(t);
+            }
+        };
+    }
+
+    /**
+     * Gets predicate (not perr-deployable) that evaluates to {@code true} if its free variable is equal
+     * to {@code target} or both are {@code null}.
+     *
+     * @param target Object to compare free variable to.
+     * @param <T> Type of the free variable, i.e. the element the predicate is called on.
+     * @return Predicate that evaluates to {@code true} if its free variable is equal to
+     *      {@code target} or both are {@code null}.
+     */
+    public static <T> IgnitePredicate<T> equalTo(@Nullable final T target) {
+        return new P1<T>() {
+            @Override public boolean apply(T t) {
+                return F.eq(t, target);
+            }
+        };
+    }
+
+    /**
      * @param p1 Filter1.
      * @param p2 Filter2.
      * @return And filter.
@@ -56,12 +133,16 @@ public class F0 {
         if (e1 && e2)
             return CU.alwaysTrue0();
 
-        if (e1) {
+        if (e1 && !e2) {
+            assert p2 != null;
+
             if (p2.length == 1)
                 return p2[0];
         }
 
-        if (e2) {
+        if (!e1 && e2) {
+            assert p1 != null;
+
             if (p1.length == 1)
                 return p1[0];
         }
@@ -69,12 +150,16 @@ public class F0 {
         return new CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
             @Override public boolean apply(GridCacheEntryEx e) {
                 if (!e1) {
+                    assert p1 != null;
+
                     for (CacheEntryPredicate p : p1)
                         if (p != null && !p.apply(e))
                             return false;
                 }
 
                 if (!e2) {
+                    assert p2 != null;
+
                     for (CacheEntryPredicate p : p2)
                         if (p != null && !p.apply(e))
                             return false;
@@ -101,11 +186,15 @@ public class F0 {
 
             @Override public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException {
                 if (!e1) {
+                    assert p1 != null;
+
                     for (CacheEntryPredicate p : p1)
                         p.prepareMarshal(ctx);
                 }
 
                 if (!e2) {
+                    assert p2 != null;
+
                     for (CacheEntryPredicate p : p2)
                         p.prepareMarshal(ctx);
                 }
@@ -114,6 +203,63 @@ public class F0 {
     }
 
     /**
+     * @param p Filter1.
+     * @param ps Filter2.
+     * @return And filter.
+     */
+    public static CacheEntryPredicate and0(
+        @Nullable final CacheEntryPredicate p,
+        @Nullable final CacheEntryPredicate... ps) {
+        if (p == null && F.isEmptyOrNulls(ps))
+            return CU.alwaysTrue0();
+
+        if (F.isAlwaysFalse(p) && F.isAlwaysFalse(ps))
+            return CU.alwaysFalse0();
+
+        if (F.isAlwaysTrue(p) && F.isAlwaysTrue(ps))
+            return CU.alwaysTrue0();
+
+        return new CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
+            @Override public boolean apply(GridCacheEntryEx e) {
+                assert ps != null;
+
+                if (p != null && !p.apply(e))
+                    return false;
+
+                for (CacheEntryPredicate p : ps) {
+                    if (p != null && !p.apply(e))
+                        return false;
+                }
+
+                return true;
+            }
+
+            @Override public void entryLocked(boolean locked) {
+                assert ps != null;
+
+                if (p != null)
+                    p.entryLocked(locked);
+
+                for (CacheEntryPredicate p : ps) {
+                    if (p != null)
+                        p.entryLocked(locked);
+                }
+            }
+
+            @Override public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException {
+                assert ps != null;
+
+                if (p != null)
+                    p.prepareMarshal(ctx);
+
+                for (CacheEntryPredicate p : ps)
+                    if (p != null)
+                        p.prepareMarshal(ctx);
+            }
+        });
+    }
+
+    /**
      * Get a predicate (non peer-deployable) that evaluates to {@code true} if each of its component predicates
      * evaluates to {@code true}. The components are evaluated in order they are supplied.
      * Evaluation will be stopped as soon as first predicate evaluates to {@code false}.
@@ -141,12 +287,16 @@ public class F0 {
         if (e1 && e2)
             return F.alwaysTrue();
 
-        if (e1) {
+        if (e1 && !e2) {
+            assert p2 != null;
+
             if (p2.length == 1)
                 return (IgnitePredicate<T>)p2[0];
         }
 
-        if (e2) {
+        if (!e1 && e2) {
+            assert p1 != null;
+
             if (p1.length == 1)
                 return (IgnitePredicate<T>)p1[0];
         }
@@ -155,11 +305,15 @@ public class F0 {
             Set<UUID> ids = new GridLeanSet<>();
 
             if (!e1) {
+                assert p1 != null;
+
                 for (IgnitePredicate<? super T> p : p1)
                     ids.addAll(((GridNodePredicate)p).nodeIds());
             }
 
             if (!e2) {
+                assert p2 != null;
+
                 for (IgnitePredicate<? super T> p : p2)
                     ids.addAll(((GridNodePredicate)p).nodeIds());
             }
@@ -171,12 +325,16 @@ public class F0 {
             return new P1<T>() {
                 @Override public boolean apply(T t) {
                     if (!e1) {
+                        assert p1 != null;
+
                         for (IgnitePredicate<? super T> p : p1)
                             if (p != null && !p.apply(t))
                                 return false;
                     }
 
                     if (!e2) {
+                        assert p2 != null;
+
                         for (IgnitePredicate<? super T> p : p2)
                             if (p != null && !p.apply(t))
                                 return false;
@@ -189,6 +347,148 @@ public class F0 {
     }
 
     /**
+     * Get a predicate (not peer-deployable) that evaluates to {@code true} if each of its component predicates
+     * evaluates to {@code true}. The components are evaluated in order they are supplied.
+     * Evaluation will be stopped as soon as first predicate evaluates to {@code false}.
+     * Passed in predicates are NOT copied. If no predicates are passed in the returned
+     * predicate will always evaluate to {@code false}.
+     *
+     * @param ps Passed in predicate. If none provided - always-{@code false} predicate is
+     *      returned.
+     * @param <T> Type of the free variable, i.e. the element the predicate is called on.
+     * @return Predicate that evaluates to {@code true} if each of its component predicates
+     *      evaluates to {@code true}.
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> IgnitePredicate<T> and(
+        @Nullable final IgnitePredicate<? super T> p,
+        @Nullable final IgnitePredicate<? super T>... ps
+    ) {
+        if (p == null && F.isEmptyOrNulls(ps))
+            return F.alwaysTrue();
+
+        if (F.isAlwaysFalse(p) && F.isAlwaysFalse(ps))
+            return F.alwaysFalse();
+
+        if (F.isAlwaysTrue(p) && F.isAlwaysTrue(ps))
+            return F.alwaysTrue();
+
+        if (isAllNodePredicates(p) && isAllNodePredicates(ps)) {
+            assert ps != null;
+
+            Set<UUID> ids = new GridLeanSet<>();
+
+            for (IgnitePredicate<? super T> p0 : ps) {
+                Collection<UUID> list = ((GridNodePredicate)p0).nodeIds();
+
+                if (ids.isEmpty())
+                    ids.addAll(list);
+                else
+                    ids.retainAll(list);
+            }
+
+            Collection<UUID> list = ((GridNodePredicate)p).nodeIds();
+
+            if (ids.isEmpty())
+                ids.addAll(list);
+            else
+                ids.retainAll(list);
+
+            // T must be <T extends GridNode>.
+            return (IgnitePredicate<T>)new GridNodePredicate(ids);
+        }
+        else {
+            return new P1<T>() {
+                @Override public boolean apply(T t) {
+                    assert ps != null;
+
+                    if (p != null && !p.apply(t))
+                        return false;
+
+                    for (IgnitePredicate<? super T> p : ps)
+                        if (p != null && !p.apply(t))
+                            return false;
+
+                    return true;
+                }
+            };
+        }
+    }
+
+    /**
+     * Gets predicate (not peer-deployable) that returns {@code true} if its free variable is contained
+     * in given collection.
+     *
+     * @param c Collection to check for containment.
+     * @param <T> Type of the free variable for the predicate and type of the
+     *      collection elements.
+     * @return Predicate (not peer-deployable) that returns {@code true} if its free variable is
+     *      contained in given collection.
+     */
+    public static <T> IgnitePredicate<T> in(@Nullable final Collection<? extends T> c) {
+        return F.isEmpty(c) ? GridFunc.<T>alwaysFalse() : new P1<T>() {
+            @Override public boolean apply(T t) {
+                assert c != null;
+
+                return c.contains(t);
+            }
+        };
+    }
+
+    /**
+     * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element
+     * that is contained in the passed in collection.
+     *
+     * @param c Collection used for predicate filter.
+     * @param <T> Element type.
+     * @return Predicate which returns {@code true} if it receives an element
+     *  that is contained in the passed in collection.
+     */
+    public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) {
+        return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new P1<T>() {
+            @Override public boolean apply(T t) {
+                return c.contains(t);
+            }
+        };
+    }
+
+    /**
+     * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element
+     * that is not contained in the passed in collection.
+     *
+     * @param c Collection used for predicate filter.
+     * @param <T> Element type.
+     * @return Predicate which returns {@code true} if it receives an element
+     *  that is not contained in the passed in collection.
+     */
+    public static <T> IgnitePredicate<T> notContains(@Nullable final Collection<T> c) {
+        return c == null || c.isEmpty() ? GridFunc.<T>alwaysTrue() : new P1<T>() {
+            @Override public boolean apply(T t) {
+                return !c.contains(t);
+            }
+        };
+    }
+
+    /**
+     * Tests if all passed in predicates are instances of {@link GridNodePredicate} class.
+     *
+     * @param ps Collection of predicates to test.
+     * @return {@code True} if all passed in predicates are instances of {@link GridNodePredicate} class.
+     */
+    public static boolean isAllNodePredicates(@Nullable Iterable<? extends IgnitePredicate<?>> ps) {
+        if (F.isEmpty(ps))
+            return false;
+
+        assert ps != null;
+
+        for (IgnitePredicate<?> p : ps)
+            if (!(p instanceof GridNodePredicate))
+                return false;
+
+        return true;
+    }
+
+    /**
      * Tests if all passed in predicates are instances of {@link GridNodePredicate} class.
      *
      * @param ps Collection of predicates to test.
@@ -198,10 +498,27 @@ public class F0 {
         if (F.isEmpty(ps))
             return false;
 
+        assert ps != null;
+
         for (IgnitePredicate<?> p : ps)
             if (!(p instanceof GridNodePredicate))
                 return false;
 
         return true;
     }
+
+    /**
+     * Creates map with given values, adding a strict not-null check for value.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @param <K> Key's type.
+     * @param <V> Value's type.
+     * @return Created map.
+     */
+    public static <K, V> Map<K, V> asMap(K key, V val) {
+        A.notNull(val, "val");
+
+        return F.asMap(key, val);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
index fc2e3a2..a23fe28 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
@@ -71,13 +71,13 @@ public class GridExecutionStatistics {
 
         long time = startTime.get().get2();
 
-        AtomicInteger cnt = F.addIfAbsent(cntMap, name, new AtomicInteger());
+        AtomicInteger cnt = F.addIfAbsent(cntMap, name, F.newAtomicInt());
 
         assert cnt != null;
 
         cnt.incrementAndGet();
 
-        AtomicLong d = F.addIfAbsent(durationMap, name, new AtomicLong());
+        AtomicLong d = F.addIfAbsent(durationMap, name, F.newAtomicLong());
 
         assert d != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ddbe2d59/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index a92ccab..480859d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8508,7 +8508,7 @@ public abstract class IgniteUtils {
             throw new IgniteCheckedException("Addresses can not be resolved [addr=" + addrs +
                 ", hostNames=" + hostNames + ']');
 
-        return Collections.unmodifiableList(res);
+        return F.viewListReadOnly(res, F.<InetAddress>identity());
     }
 
     /**
@@ -8555,7 +8555,7 @@ public abstract class IgniteUtils {
             res.add(new InetSocketAddress(addr, port));
         }
 
-        return Collections.unmodifiableList(res);
+        return F.viewListReadOnly(res, F.<InetSocketAddress>identity());
     }
 
     /**


Mime
View raw message