static Set getSortedSet(L l, S field) { new TreeSet set; for (O o : l) { O x = cast getOpt(o, field); if (x != null) set.add(x); } ret set; }