static int indexOfOccurrence(L l, A x, int n) { for (int i = 0; i < l(l); i++) if (eq(l.get(i), x) && --n < 0) ret i; ret -1; }