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 15:32:41 UTC
[5/5] ignite git commit: IGNITE-2263: Removed "lose" method. GridFunc
has no warnings for now.
IGNITE-2263: Removed "lose" method. GridFunc has no warnings for now.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c4cae9d3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c4cae9d3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c4cae9d3
Branch: refs/heads/ignite-2263
Commit: c4cae9d3cdaf64c02385dcee8b73309458f2d31b
Parents: 9214e3c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 17:33:17 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 17:33:17 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/util/lang/GridFunc.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4cae9d3/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 f30abcc..b5e7da9 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
@@ -825,11 +825,11 @@ public class GridFunc {
* @param c Input collection.
* @param cp If {@code true} method creates new collection without modifying the input one,
* otherwise does <tt>in-place</tt> modifications.
- * @param p Predicates to filter by. If no predicates provided - no elements are lost.
+ * @param p Predicate.
* @param <T> Type of collections.
* @return Collection of remaining elements.
*/
- public static <T> Collection<T> lose(Collection<T> c, boolean cp, @Nullable IgnitePredicate<? super T>... p) {
+ public static <T> Collection<T> lose(Collection<T> c, boolean cp, IgnitePredicate<? super T> p) {
A.notNull(c, "c");
Collection<T> res;
@@ -837,19 +837,18 @@ public class GridFunc {
if (!cp) {
res = c;
- if (isEmpty(p))
- res.clear();
- else if (!isAlwaysFalse(p))
- for (Iterator<T> iter = res.iterator(); iter.hasNext();)
- if (isAll(iter.next(), p))
+ if (!isAlwaysFalse(p)) {
+ for (Iterator<T> iter = res.iterator(); iter.hasNext(); )
+ if (p.apply(iter.next()))
iter.remove();
+ }
}
else {
res = new LinkedList<>();
- if (!isEmpty(p) && !isAlwaysTrue(p))
+ if (!isAlwaysTrue(p))
for (T t : c)
- if (!isAll(t, p))
+ if (!p.apply(t))
res.add(t);
}