static L replaceElementInSubList(L l, int from, int to, A a, A b) { for (int i = from; i < to; i++) if (eq(l.get(i), a)) l.set(i, b); ret l; }