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 2016/06/17 08:54:49 UTC

[40/41] ignite git commit: Compatibility 7.5.26 fix

Compatibility 7.5.26 fix


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

Branch: refs/heads/ignite-3331
Commit: f7da0ddbeac3c47f322e794231fe209c2e5d7216
Parents: ee41656
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Jun 16 18:28:37 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Jun 16 18:28:37 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/lang/GridFunc.java     | 68 +++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f7da0ddb/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 20e31c6..a3eae7d 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
@@ -1695,6 +1695,72 @@ public class GridFunc {
     }
 
     /**
+     * Creates read-only light-weight view on given list with provided transformation.
+     * Resulting list will only "have" {@code transformed} elements. Note that only wrapping
+     * list will be created and no duplication of data will occur.
+     *
+     * @param c Input list that serves as a base for the view.
+     * @param trans Transformation closure.
+     * @param <T1> Type of the list.
+     * @return Light-weight view on given list with provided transformation.
+     */
+    @SuppressWarnings("RedundantTypeArguments")
+    @Deprecated
+    public static <T1, T2> List<T2> viewListReadOnly(@Nullable final List<? extends T1> c,
+        final IgniteClosure<? super T1, T2> trans) {
+        A.notNull(trans, "trans");
+
+        if (isEmpty(c))
+            return Collections.emptyList();
+
+        assert c != null;
+
+        return new GridSerializableList<T2>() {
+            /** */
+            private static final long serialVersionUID = 3126625219739967068L;
+
+            @Override public T2 get(int idx) {
+                return trans.apply(c.get(idx));
+            }
+
+            @NotNull
+            @Override public Iterator<T2> iterator() {
+                return F.<T1, T2>iterator(c, trans, true);
+            }
+
+            @Override public int size() {
+                return c.size();
+            }
+
+            @Override public boolean isEmpty() {
+                return c.isEmpty();
+            }
+        };
+    }
+
+    /**
+     * Creates a view on given list with provided transformer and predicates.
+     * Resulting list will only "have" elements for which all provided predicates, if any,
+     * evaluate to {@code true}. Note that a new collection will be created and data will
+     * be copied.
+     *
+     * @param c Input list that serves as a base for the view.
+     * @param trans Transforming closure from T1 to T2.
+     * @param p Optional predicates. If predicates are not provided - all elements will be in the view.
+     * @return View on given list with provided predicate.
+     */
+    @Deprecated
+    public static <T1, T2> List<T2> transformList(Collection<? extends T1> c,
+        IgniteClosure<? super T1, T2> trans, @Nullable IgnitePredicate<? super T1>... p) {
+        A.notNull(c, "c", trans, "trans");
+
+        if (isAlwaysFalse(p))
+            return Collections.emptyList();
+
+        return new ArrayList<>(transform(retain(c, true, p), trans));
+    }
+
+    /**
      * Creates light-weight view on given map with provided predicates. Resulting map will
      * only "have" keys for which all provided predicates, if any, evaluates to {@code true}.
      * Note that only wrapping map will be created and no duplication of data will occur.
@@ -4514,4 +4580,4 @@ public class GridFunc {
     public static IgnitePredicate<IgniteInternalFuture<?>> unfinishedFutures() {
         return UNFINISHED_FUTURE;
     }
-}
\ No newline at end of file
+}