ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [3/3] ignite git commit: IGNITE-2263: Simplified iterator(Iterator, transformer) method - no predicates are ever passed.
Date Wed, 30 Dec 2015 13:53:45 GMT
IGNITE-2263: Simplified iterator(Iterator, transformer) method - no predicates are ever passed.


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

Branch: refs/heads/ignite-2263
Commit: 2f1fbb95570bd7199c1fa4fdcf05daf039167142
Parents: 28b984a
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Dec 30 16:54:40 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Dec 30 16:54:40 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/lang/GridFunc.java     | 64 +-------------------
 1 file changed, 3 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1fbb95/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 e563616..e1d7b82 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
@@ -1993,80 +1993,22 @@ public class GridFunc {
      * @param trans Transforming closure to convert from T1 to T2.
      * @param readOnly If {@code true}, then resulting iterator will not allow modifications
      *      to the underlying collection.
-     * @param p Optional filtering predicates.
      * @return Iterator from given iterator and optional filtering predicate.
      */
     public static <T1, T2> Iterator<T2> iterator(final Iterator<? extends
T1> c,
-        final IgniteClosure<? super T1, T2> trans,
-        final boolean readOnly,
-        @Nullable final IgnitePredicate<? super T1>... p)
-    {
+        final IgniteClosure<? super T1, T2> trans, final boolean readOnly) {
         A.notNull(c, "c", trans, "trans");
 
-        if (isAlwaysFalse(p))
-            return F.emptyIterator();
-
         return new GridIteratorAdapter<T2>() {
             /** */
-            private T1 elem;
-
-            /** */
-            private boolean moved = true;
-
-            /** */
-            private boolean more;
-
-            /** */
             private Iterator<? extends T1> iter = c;
 
             @Override public boolean hasNextX() {
-                if (isEmpty(p))
-                    return iter.hasNext();
-                else {
-                    if (!moved)
-                        return more;
-                    else {
-                        more = false;
-
-                        while (iter.hasNext()) {
-                            elem = iter.next();
-
-                            boolean isAll = true;
-
-                            for (IgnitePredicate<? super T1> r : p)
-                                if (r != null && !r.apply(elem)) {
-                                    isAll = false;
-
-                                    break;
-                                }
-
-                            if (isAll) {
-                                more = true;
-                                moved = false;
-
-                                return true;
-                            }
-                        }
-
-                        elem = null; // Give to GC.
-
-                        return false;
-                    }
-                }
+                return iter.hasNext();
             }
 
             @Nullable @Override public T2 nextX() {
-                if (isEmpty(p))
-                    return trans.apply(iter.next());
-                else {
-                    if (hasNext()) {
-                        moved = true;
-
-                        return trans.apply(elem);
-                    }
-                    else
-                        throw new NoSuchElementException();
-                }
+                return trans.apply(iter.next());
             }
 
             @Override public void removeX() {


Mime
View raw message