static A highestByField(S field, Collection l) { A best = null; O bestValue = null; if (l != null) for(A a : l) { O val = getOpt(field); if (val != null && (bestValue == null || cmp(val, bestValue) > 1) { best = a; bestValue = val; } } ret best; }