ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [4/8] ignite git commit: IGNITE-2263: Further simplification.
Date Wed, 30 Dec 2015 09:52:23 GMT
IGNITE-2263: Further simplification.


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

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

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


http://git-wip-us.apache.org/repos/asf/ignite/blob/2d550b53/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index abacf85..65c985b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -2658,27 +2658,13 @@ public class GridFunc {
      */
     @SuppressWarnings("unchecked")
     public static <T, C extends Collection<T>> C addAll(C c, Iterable<? extends
T> it) {
-        if (it == null)
-            return c;
-
-        if (it instanceof Collection<?>) {
-            c.addAll((Collection<? extends T>)it);
-
-            return c;
-        }
-
-        return addAll(c, it.iterator());
-    }
-
-    /**
-     * @param c Target collection.
-     * @param it Iterator to fetch.
-     * @return Modified target collection.
-     */
-    public static <T, C extends Collection<T>> C addAll(C c, Iterator<? extends
T> it) {
         if (it != null) {
-            while (it.hasNext())
-                c.add(it.next());
+            if (it instanceof Collection<?>)
+                c.addAll((Collection<? extends T>)it);
+            else {
+                for (T item : it)
+                    c.add(item);
+            }
         }
 
         return c;


Mime
View raw message