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 12:41:16 UTC
[1/8] ignite git commit: IGNITE-2263: Minor change to containsAny().
Repository: ignite
Updated Branches:
refs/heads/ignite-2263 6f7de6ac2 -> aaeb383e9
IGNITE-2263: Minor change to containsAny().
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f1e16a73
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f1e16a73
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f1e16a73
Branch: refs/heads/ignite-2263
Commit: f1e16a73e68a2148ef81f0dc9de7cb9ccf4e4fb8
Parents: 6f7de6a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:25:06 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:25:06 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/util/lang/GridFunc.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f1e16a73/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 4036686..f95df93 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
@@ -2851,7 +2851,7 @@ public class GridFunc {
* @return {@code true} if collection {@code c1} contains at least one element from collection
* {@code c2}.
*/
- public static <T> boolean containsAny(@Nullable Collection<? extends T> c1, @Nullable T... c2) {
+ public static <T> boolean containsAny(@Nullable Collection<? extends T> c1, @Nullable T[] c2) {
if (c1 != null && !c1.isEmpty() && c2 != null && c2.length > 0)
for (T t : c2)
if (c1.contains(t))
[4/8] ignite git commit: IGNITE-2263: Optimized isAll() and isAny()
methods.
Posted by vo...@apache.org.
IGNITE-2263: Optimized isAll() and isAny() methods.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1a7a6539
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1a7a6539
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1a7a6539
Branch: refs/heads/ignite-2263
Commit: 1a7a6539c5f10dbcae6f88142baacf7cb791ab57
Parents: df4029f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:32:42 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:32:42 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/lang/GridFunc.java | 25 +++++++++-----------
1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1a7a6539/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 4409fd6..0561040 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
@@ -2729,8 +2729,7 @@ public class GridFunc {
* @return Returns {@code true} if given set of predicates is {@code null}, is empty, or all predicates
* evaluate to {@code true} for given value, {@code false} otherwise.
*/
- @SuppressWarnings("unchecked")
- public static <T> boolean isAll(@Nullable T t, @Nullable IgnitePredicate<? super T>... p) {
+ public static <T> boolean isAll(@Nullable T t, @Nullable IgnitePredicate<? super T>[] p) {
if (p != null)
for (IgnitePredicate<? super T> r : p)
if (r != null && !r.apply(t))
@@ -2751,11 +2750,10 @@ public class GridFunc {
* value, {@code false} otherwise. Returns {@code false} if given set of predicates
* is {@code null} or empty.
*/
- public static <T> boolean isAny(@Nullable T t, @Nullable IgnitePredicate<? super T>... p) {
+ public static <T> boolean isAny(@Nullable T t, @Nullable IgnitePredicate<? super T> p) {
if (p != null)
- for (IgnitePredicate<? super T> r : p)
- if (r != null && r.apply(t))
- return true;
+ if (p != null && p.apply(t))
+ return true;
return false;
}
@@ -2780,13 +2778,12 @@ public class GridFunc {
* @return First element in given collection for which predicate evaluates to
* {@code true} - or {@code null} if such element cannot be found.
*/
- @Nullable public static <V> V find(Iterable<? extends V> c, @Nullable V dfltVal,
- @Nullable IgnitePredicate<? super V> p) {
+ @Nullable public static <V> V find(Iterable<? extends V> c, @Nullable V dfltVal, IgnitePredicate<? super V> p) {
A.notNull(c, "c");
if (!isAlwaysFalse(p)) {
for (V v : c) {
- if (isAny(v, p))
+ if (p.apply(v))
return v;
}
}
@@ -2874,7 +2871,7 @@ public class GridFunc {
* @return {@code true} if input collection contains element for which all the provided
* predicates evaluates to {@code true} - otherwise returns {@code false}.
*/
- public static <V> boolean exist(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V> p) {
+ public static <V> boolean exist(Iterable<? extends V> c, IgnitePredicate<? super V> p) {
A.notNull(c, "c");
if (isAlwaysFalse(p))
@@ -2883,7 +2880,7 @@ public class GridFunc {
return true;
else
for (V v : c)
- if (isAll(v, p))
+ if (p.apply(v))
return true;
return false;
@@ -2909,7 +2906,7 @@ public class GridFunc {
return true;
else {
for (V v : c) {
- if (!isAll(v, p))
+ if (!p.apply(v))
return false;
}
}
@@ -2938,7 +2935,7 @@ public class GridFunc {
return true;
else {
for (Map.Entry<K, V> e : m.entrySet())
- if (!isAll(e, p))
+ if (!p.apply(e))
return false;
}
@@ -2966,7 +2963,7 @@ public class GridFunc {
return true;
else {
for (V v : c)
- if (isAll(v, p))
+ if (p.apply(v))
return true;
return false;
[3/8] ignite git commit: IGNITE-2263: Optimized find() methods.
Posted by vo...@apache.org.
IGNITE-2263: Optimized find() methods.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df4029f2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df4029f2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df4029f2
Branch: refs/heads/ignite-2263
Commit: df4029f2416400dc7d99959b6089a3880a13fb13
Parents: f348fe1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:28:00 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:28:00 2015 +0300
----------------------------------------------------------------------
.../top/GridTopologyCommandHandler.java | 3 +-
.../ignite/internal/util/lang/GridFunc.java | 34 ++------------------
2 files changed, 3 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/df4029f2/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 297785e..5e12199 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,8 +135,7 @@ 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/df4029f2/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 dfbcb4f..4409fd6 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
@@ -2780,12 +2780,11 @@ public class GridFunc {
* @return First element in given collection for which predicate evaluates to
* {@code true} - or {@code null} if such element cannot be found.
*/
- @SafeVarargs
@Nullable public static <V> V find(Iterable<? extends V> c, @Nullable V dfltVal,
- @Nullable IgnitePredicate<? super V>... p) {
+ @Nullable IgnitePredicate<? super V> p) {
A.notNull(c, "c");
- if (!isEmpty(p) && !isAlwaysFalse(p)) {
+ if (!isAlwaysFalse(p)) {
for (V v : c) {
if (isAny(v, p))
return v;
@@ -2796,35 +2795,6 @@ public class GridFunc {
}
/**
- * Finds, transforms and returns first element in given collection for which any of
- * the provided predicates evaluates to {@code true}.
- *
- * @param c Input collection.
- * @param dfltVal Default value to return when no element is found.
- * @param f Transforming closure.
- * @param p Optional set of finder predicates.
- * @param <V> Type of the collection elements.
- * @return First element in given collection for which predicate evaluates to
- * {@code true} - or {@code null} if such element cannot be found.
- */
- public static <V, Y> Y find(Iterable<? extends V> c, @Nullable Y dfltVal, IgniteClosure<? super V, Y> f,
- @Nullable IgnitePredicate<? super V>... p) {
- A.notNull(c, "c", f, "f");
-
- if (isAlwaysTrue(p) && c.iterator().hasNext())
- return f.apply(c.iterator().next());
-
- if (!isEmpty(p) && !isAlwaysFalse(p)) {
- for (V v : c) {
- if (isAny(v, p))
- return f.apply(v);
- }
- }
-
- return dfltVal;
- }
-
- /**
* Checks if collection {@code c1} contains any elements from collection {@code c2}.
*
* @param c1 Collection to check for containment. If {@code null} - this method returns {@code false}.
[5/8] ignite git commit: IGNITE-2263: Removed unused isAny() method.
Posted by vo...@apache.org.
IGNITE-2263: Removed unused isAny() method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c8d3f5d7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c8d3f5d7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c8d3f5d7
Branch: refs/heads/ignite-2263
Commit: c8d3f5d74af454e2e08ca9b65d6b002601ec855e
Parents: 1a7a653
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:33:07 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:33:07 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/lang/GridFunc.java | 20 --------------------
1 file changed, 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d3f5d7/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 0561040..5e559f0 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
@@ -2739,26 +2739,6 @@ public class GridFunc {
}
/**
- * Tests if any of provided predicates evaluate to {@code true} for given value. Note
- * that evaluation will be short-circuit when first predicate evaluated to {@code true}
- * is found.
- *
- * @param t Value to test.
- * @param p Optional set of predicates to use for evaluation.
- * @param <T> Type of the value and free variable of the predicates.
- * @return Returns {@code true} if any of predicates evaluates to {@code true} for given
- * value, {@code false} otherwise. Returns {@code false} if given set of predicates
- * is {@code null} or empty.
- */
- public static <T> boolean isAny(@Nullable T t, @Nullable IgnitePredicate<? super T> p) {
- if (p != null)
- if (p != null && p.apply(t))
- return true;
-
- return false;
- }
-
- /**
* Creates an absolute (no-arg) closure that does nothing.
*
* @return Absolute (no-arg) closure that does nothing.
[7/8] ignite git commit: IGNITE-2263: Minor change.
Posted by vo...@apache.org.
IGNITE-2263: Minor change.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d777a4eb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d777a4eb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d777a4eb
Branch: refs/heads/ignite-2263
Commit: d777a4eb787aa795598333ac8306a3eae582eee7
Parents: 5bd4f8a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:36:47 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:36:47 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/util/lang/GridFunc.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d777a4eb/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 e9f2b16..d3adce5 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
@@ -1113,6 +1113,7 @@ public class GridFunc {
* @param <T> Array type.
* @return {@link List} instance for array.
*/
+ @SuppressWarnings("unchecked")
public static <T> List<T> asList(@Nullable T... vals) {
return isEmpty(vals) ? Collections.<T>emptyList() : Arrays.asList(vals);
}
[8/8] ignite git commit: IGNITE-2263: Removed unnecessary assertions.
Posted by vo...@apache.org.
IGNITE-2263: Removed unnecessary assertions.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aaeb383e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aaeb383e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aaeb383e
Branch: refs/heads/ignite-2263
Commit: aaeb383e9e875ba9717f7aec74658387dad4ddda
Parents: d777a4e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:42:09 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:42:09 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/lang/GridFunc.java | 61 ++++----------------
1 file changed, 12 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeb383e/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 d3adce5..71eaff3 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
@@ -46,7 +46,6 @@ import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.GridSerializableCollection;
import org.apache.ignite.internal.util.GridSerializableIterator;
-import org.apache.ignite.internal.util.GridSerializableList;
import org.apache.ignite.internal.util.GridSerializableMap;
import org.apache.ignite.internal.util.GridSerializableSet;
import org.apache.ignite.internal.util.typedef.C1;
@@ -437,8 +436,6 @@ public class GridFunc {
if (isEmpty(res))
return Collections.emptyList();
- assert res != null;
-
Collection<T> c = new ArrayList<>(res.size());
for (ComputeJobResult r : res)
@@ -574,8 +571,6 @@ public class GridFunc {
return l;
}
- assert c != null;
-
Collection<T> ret = new ArrayList<>(c.size() + 1);
ret.add(t);
@@ -587,8 +582,6 @@ public class GridFunc {
if (isEmpty(c))
return Collections.singletonList(t);
- assert c != null;
-
return new GridSerializableCollection<T>() {
@NotNull
@Override public Iterator<T> iterator() {
@@ -645,8 +638,11 @@ public class GridFunc {
if (isEmpty(c1) && isEmpty(c2))
return new ArrayList<>(0);
- if (isEmpty(c1))
+ if (isEmpty(c1)) {
+ assert c2 != null;
+
return new ArrayList<>(c2);
+ }
if (isEmpty(c2))
return new ArrayList<>(c1);
@@ -823,8 +819,7 @@ public class GridFunc {
* @param <T> Type of collections.
* @return Collection of remaining elements
*/
- public static <T0, T extends T0> Collection<T> lose(Collection<T> c, boolean cp,
- @Nullable Collection<T0> filter) {
+ public static <T0, T extends T0> Collection<T> lose(Collection<T> c, boolean cp, @Nullable Collection<T0> filter) {
A.notNull(c, "c");
return lose(c, cp, F0.in(filter));
@@ -879,6 +874,7 @@ public class GridFunc {
* @param <T> Type of list.
* @return List of remaining elements
*/
+ // TODO: REMOVE!
public static <T> List<T> loseList(List<T> c, boolean cp, @Nullable Collection<? super T> filter) {
A.notNull(c, "c");
@@ -1369,8 +1365,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyList();
- assert c != null;
-
return isEmpty(p) || isAlwaysTrue(p) ? c : new GridSerializableCollection<T>() {
// Pass through (will fail for readonly).
@Override public boolean add(T e) {
@@ -1415,8 +1409,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyList();
- assert c != null;
-
return new GridSerializableCollection<T2>() {
@NotNull
@Override public Iterator<T2> iterator() {
@@ -1451,8 +1443,6 @@ public class GridFunc {
if (isEmpty(m) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert m != null;
-
return isEmpty(p) || isAlwaysTrue(p) ? m : new GridSerializableMap<K, V>() {
/** */
private static final long serialVersionUID = 5531745605372387948L;
@@ -1539,8 +1529,6 @@ public class GridFunc {
if (isEmpty(m) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert m != null;
-
final boolean hasPred = p != null && p.length > 0;
return new GridSerializableMap<K, V1>() {
@@ -1613,7 +1601,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)
@@ -1662,8 +1650,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert c != null;
-
return new GridSerializableMap<K, V>() {
/** Entry predicate. */
private IgnitePredicate<K> ep = new P1<K>() {
@@ -2176,8 +2162,9 @@ public class GridFunc {
* @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 {@code null}.
*/
+ @SuppressWarnings("unchecked")
public static <T> IgnitePredicate<T> isNull() {
- return (IgnitePredicate<T>) IS_NULL;
+ return (IgnitePredicate<T>)IS_NULL;
}
/**
@@ -2186,8 +2173,9 @@ public class GridFunc {
* @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 not {@code null}.
*/
+ @SuppressWarnings("unchecked")
public static <T> IgnitePredicate<T> notNull() {
- return (IgnitePredicate<T>) IS_NOT_NULL;
+ return (IgnitePredicate<T>)IS_NOT_NULL;
}
/**
@@ -2265,24 +2253,6 @@ public class GridFunc {
}
/**
- * Gets predicate that evaluates to {@code true} if its free variable is instance of the given class.
- *
- * @param cls Class to compare 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 instance
- * of the given class.
- */
- public static <T> IgnitePredicate<T> instanceOf(final Class<?> cls) {
- A.notNull(cls, "cls");
-
- return new P1<T>() {
- @Override public boolean apply(T t) {
- return t != null && cls.isAssignableFrom(t.getClass());
- }
- };
- }
-
- /**
* Gets first element from given collection or returns {@code null} if the collection is empty.
*
* @param c A collection.
@@ -2322,12 +2292,11 @@ public class GridFunc {
* @param <T> Type of the collection.
* @return Collections' first element or {@code null} in case if the collection is empty.
*/
+ @SuppressWarnings("unchecked")
@Nullable public static <T> T last(@Nullable Iterable<? extends T> c) {
if (c == null)
return null;
- assert c != null;
-
if (c instanceof RandomAccess && c instanceof List) {
List<T> l = (List<T>)c;
@@ -2412,8 +2381,6 @@ public class GridFunc {
return F.alwaysTrue();
if (F0.isAllNodePredicates(ps)) {
- assert ps != null;
-
Set<UUID> ids = new HashSet<>();
for (IgnitePredicate<? super T> p : ps) {
@@ -2433,8 +2400,6 @@ public class GridFunc {
else {
return new P1<T>() {
@Override public boolean apply(T t) {
- assert ps != null;
-
for (IgnitePredicate<? super T> p : ps)
if (p != null && !p.apply(t))
return false;
@@ -2483,8 +2448,6 @@ public class GridFunc {
public static <T> IgnitePredicate<T> notIn(@Nullable final Collection<? extends T> c) {
return isEmpty(c) ? GridFunc.<T>alwaysTrue() : new P1<T>() {
@Override public boolean apply(T t) {
- assert c != null;
-
return !c.contains(t);
}
};
[2/8] ignite git commit: IGNITE-2263: Optimized exist() method.
Posted by vo...@apache.org.
IGNITE-2263: Optimized exist() method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f348fe1e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f348fe1e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f348fe1e
Branch: refs/heads/ignite-2263
Commit: f348fe1e8f8c77aa3e200b945f32fe8703ef622b
Parents: f1e16a7
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:25:59 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:25:59 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/util/lang/GridFunc.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f348fe1e/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 f95df93..dfbcb4f 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
@@ -2904,15 +2904,13 @@ public class GridFunc {
* @return {@code true} if input collection contains element for which all the provided
* predicates evaluates to {@code true} - otherwise returns {@code false}.
*/
- public static <V> boolean exist(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V>... p) {
+ public static <V> boolean exist(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V> p) {
A.notNull(c, "c");
if (isAlwaysFalse(p))
return false;
else if (isAlwaysTrue(p))
return true;
- else if (isEmpty(p))
- return true;
else
for (V v : c)
if (isAll(v, p))
[6/8] ignite git commit: IGNITE-2263: Optimized forEach() method.
Posted by vo...@apache.org.
IGNITE-2263: Optimized forEach() method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5bd4f8a2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5bd4f8a2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5bd4f8a2
Branch: refs/heads/ignite-2263
Commit: 5bd4f8a2b0f686ff100afb3a69457821d1d3cd4d
Parents: c8d3f5d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 14:34:35 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 14:34:35 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/util/lang/GridFunc.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5bd4f8a2/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 5e559f0..e9f2b16 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
@@ -2665,11 +2665,11 @@ public class GridFunc {
* collection elements.
*/
public static <X> void forEach(Iterable<? extends X> c, IgniteInClosure<? super X> f,
- @Nullable IgnitePredicate<? super X>... p) {
+ IgnitePredicate<? super X> p) {
A.notNull(c, "c", f, "f");
for (X x : c)
- if (isAll(x, p))
+ if (p.apply(x))
f.apply(x);
}