static void replace(L l, A a, A b) { for i over l: if (eq(l.get(i), a)) l.set(i, b); }