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 L replace(A a, A b, L l) { ret replace(l, a, b); } // replace all occurrences of a in s with b sS replace(S s, S a, S b) { ret s == null ? null : a == null || b == null ? s : s.replace(a, b); } sS replace(S s, char a, char b) { ret s == null ? null : s.replace(a, b); }