static L replace(L l, A a, A b) { for i over l: if (eq(l.get(i), a)) l.set(i, b); ret l; } static S replace(S s, S a, S b) { ret s == null ? null : a == null || b == null ? s : s.replace(a, b); }