static A smallestByMethod(Collection l, S method, O... args) { A best = null; O bestValue = null; if (l != null) for(A a : l) { O val = callOpt(a, method, args); if (val != null && (bestValue == null || cmp(val, bestValue) < 0)) { best = a; bestValue = val; } } ret best; }