static void lambdaMapLike putIfHigherByCalculatedField(IF1 scorer, Map map, A key, B value) { if (map == null || key == null || value == null) ret; B existing = map.get(key); if (existing == null || cmp(scorer.get(value), scorer.get(existing)) > 0) map.put(key, value); }