Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DA2B8200B53 for ; Mon, 20 Jun 2016 14:52:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D77C4160A6C; Mon, 20 Jun 2016 12:52:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 04ACA160A8B for ; Mon, 20 Jun 2016 14:52:43 +0200 (CEST) Received: (qmail 8877 invoked by uid 500); 20 Jun 2016 12:52:43 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 7770 invoked by uid 99); 20 Jun 2016 12:52:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2016 12:52:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5A9B6ED311; Mon, 20 Jun 2016 12:52:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Mon, 20 Jun 2016 12:53:20 -0000 Message-Id: <68361aa480224accbe6cbdcd5dba6912@git.apache.org> In-Reply-To: <89985bfe12394840b4deddba739acaf2@git.apache.org> References: <89985bfe12394840b4deddba739acaf2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [40/50] ignite git commit: Compatibility 7.5.26 fix archived-at: Mon, 20 Jun 2016 12:52:46 -0000 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-3341 Commit: f7da0ddbeac3c47f322e794231fe209c2e5d7216 Parents: ee41656 Author: Anton Vinogradov Authored: Thu Jun 16 18:28:37 2016 +0300 Committer: Anton Vinogradov 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 Type of the list. + * @return Light-weight view on given list with provided transformation. + */ + @SuppressWarnings("RedundantTypeArguments") + @Deprecated + public static List viewListReadOnly(@Nullable final List c, + final IgniteClosure trans) { + A.notNull(trans, "trans"); + + if (isEmpty(c)) + return Collections.emptyList(); + + assert c != null; + + return new GridSerializableList() { + /** */ + private static final long serialVersionUID = 3126625219739967068L; + + @Override public T2 get(int idx) { + return trans.apply(c.get(idx)); + } + + @NotNull + @Override public Iterator iterator() { + return F.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 List transformList(Collection c, + IgniteClosure trans, @Nullable IgnitePredicate... 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> unfinishedFutures() { return UNFINISHED_FUTURE; } -} \ No newline at end of file +}