static int countKeysWithValue(Map map, B value) { int n = 0; for (A key : keys(map)) if (eq(map.get(key), value)) ++n; ret n; } static int countKeysWithValue(B value, Map map) { ret countKeysWithValue(map, value); }