static L sortedByFields(Collection c, final S... fields) {
L l = new ArrayList(c);
sort(l, new Comparator() {
public int compare(A a, A b) {
for (S field : fields) {
int x = cmp(getOpt(a, field), getOpt(b, field));
if (x != 0) ret x;
}
ret 0;
}
});
ret l;
}