Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.Comparator;
import java.util.List;
/**
???
**/
public class Mystery<T extends Comparable<? super T>> implements Comparator<List<T>> {
@Override
public int compare(List<T> l1, List<T> l2) {
for (int i = 0; i < l1.size() && i < l2.size(); i++) {
T c1 = l1.get(i);
T c2 = l2.get(i);
int c = c1.compareTo(c2);
if (c != 0) {
return c;
}
}
return l2.size() - l1.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.