incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [35/50] [abbrv] git commit: IteratorUtil: Add generic method to return sorted list out of a collection
Date Fri, 25 Jan 2013 03:31:46 GMT
IteratorUtil: Add generic method to return sorted list out of a collection

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


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

Branch: refs/heads/javelin
Commit: cbdeeebc6c1864e9ccdae55d0a125929e7be7b30
Parents: 8273af7
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Wed Jan 23 13:47:56 2013 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Wed Jan 23 14:57:41 2013 -0800

----------------------------------------------------------------------
 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/cbdeeebc/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 <T> Iterable<T> enumerationAsIterable(final Enumeration<T>
e) {
@@ -51,4 +54,11 @@ public class IteratorUtil {
 		    }
 		};
 	}
+
+    public static
+    <T extends Comparable<? super T>> List<T> asSortedList(Collection<T>
c) {
+        List<T> list = new ArrayList<T>(c);
+        java.util.Collections.sort(list);
+        return list;
+    }
 }


Mime
View raw message