Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 724A8E590 for ; Sat, 26 Jan 2013 16:21:59 +0000 (UTC) Received: (qmail 6865 invoked by uid 500); 26 Jan 2013 16:21:52 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 6631 invoked by uid 500); 26 Jan 2013 16:21:52 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 1420 invoked by uid 99); 26 Jan 2013 16:21:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jan 2013 16:21:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9DA3C825E1E; Sat, 26 Jan 2013 16:21:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [16/50] [abbrv] git commit: IteratorUtil: Add generic method to return sorted list out of a collection Message-Id: <20130126162139.9DA3C825E1E@tyr.zones.apache.org> Date: Sat, 26 Jan 2013 16:21:39 +0000 (UTC) IteratorUtil: Add generic method to return sorted list out of a collection Signed-off-by: Rohit Yadav Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c47c6990 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c47c6990 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c47c6990 Branch: refs/heads/marvin-refactor-phase1 Commit: c47c6990de97d44c6f79101e50183f219225ae5b Parents: d587e24 Author: Rohit Yadav Authored: Wed Jan 23 13:47:56 2013 -0800 Committer: Prasanna Santhanam Committed: Thu Jan 24 17:48:35 2013 +0530 ---------------------------------------------------------------------- utils/src/com/cloud/utils/IteratorUtil.java | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c47c6990/utils/src/com/cloud/utils/IteratorUtil.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/IteratorUtil.java b/utils/src/com/cloud/utils/IteratorUtil.java index d7a85f1..0a7fd72 100644 --- a/utils/src/com/cloud/utils/IteratorUtil.java +++ b/utils/src/com/cloud/utils/IteratorUtil.java @@ -16,8 +16,11 @@ // under the License. package com.cloud.utils; +import java.util.ArrayList; +import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; +import java.util.List; public class IteratorUtil { public static Iterable enumerationAsIterable(final Enumeration e) { @@ -51,4 +54,11 @@ public class IteratorUtil { } }; } + + public static + > List asSortedList(Collection c) { + List list = new ArrayList(c); + java.util.Collections.sort(list); + return list; + } }