Permalink
Browse files

format & import cleanup

  • Loading branch information...
1 parent a3c69dc commit 03d66bd0522e0971cb4e3b06cf53e00eac246037 @ghosthack ghosthack committed Jan 4, 2012
Showing with 19 additions and 19 deletions.
  1. +19 −19 flaptor-util/com/flaptor/util/CollectionsUtil.java
View
38 flaptor-util/com/flaptor/util/CollectionsUtil.java
@@ -16,12 +16,10 @@
package com.flaptor.util;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedSet;
@@ -57,11 +55,11 @@ public int compare(T o1, T o2) {
}
public static <T> Comparator<T> inverseComparator(final Comparator<T> comp) {
- return new Comparator<T>() {
- public int compare(T o1, T o2) {
- return comp.compare(o2, o1);
- }
- };
+ return new Comparator<T>() {
+ public int compare(T o1, T o2) {
+ return comp.compare(o2, o1);
+ }
+ };
}
public static <T extends Comparable<T>> Iterable<T> mergeIterables(final Iterable<? extends Iterable<? extends T>> iterables) {
@@ -329,19 +327,21 @@ public Float apply(String from) {
return floats;
}
- public static <T extends Comparable<T>> SortedSet<T> sortTopN(Iterable<T> iterable, int n) {
- return sortTopN(iterable, n, Ordering.<T>natural());
-
+ public static <T extends Comparable<T>> SortedSet<T> sortTopN(
+ Iterable<T> iterable, int n) {
+ return sortTopN(iterable, n, Ordering.<T> natural());
}
- public static <T> SortedSet<T> sortTopN(Iterable<T> iterable, int n, Comparator<T> comparator) {
- TreeSet<T> r = Sets.newTreeSet(comparator);
- for (T t : iterable) {
- r.add(t);
- if (r.size() > n) {
- r.pollLast();
- }
- }
- return r;
+
+ public static <T> SortedSet<T> sortTopN(Iterable<T> iterable, int n,
+ Comparator<T> comparator) {
+ TreeSet<T> r = Sets.newTreeSet(comparator);
+ for (T t : iterable) {
+ r.add(t);
+ if (r.size() > n) {
+ r.pollLast();
+ }
+ }
+ return r;
}
}

0 comments on commit 03d66bd

Please sign in to comment.