incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [12/42] git commit: refs/heads/marvin-refactor - IteratorUtil: Add generic method to return sorted list out of a collection
Date Fri, 01 Mar 2013 10:06:31 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/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
Commit: c47c6990de97d44c6f79101e50183f219225ae5b
Parents: d587e24
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Wed Jan 23 13:47:56 2013 -0800
Committer: Prasanna Santhanam <tsp@apache.org>
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 <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