static int countOccurrences(Collection c, O x) { int n = 0; if (c != null) for (O o : c) if (eq(o, x)) ++n; ret n; }