static L indicesOf(L l, A a) { if (l == null) null; ifclass IContentsIndexedList if (l cast IContentsIndexedList) ret intArrayToList(l.indicesOf(a)); endif ifclass IContentsIndexedList2 if (l cast IContentsIndexedList2) ret map(h -> h/HasIndex.idx, l.indicesOf_treeSetOfHasIndex(a)); endif new L x; for (int i = 0; i < l(l); i++) if (eq(l.get(i), a)) x.add(i); ret x; } static L indicesOf(S s, S x) { int i = -1; new L out; while ((i = indexOf(s, x, i+1)) >= 0) out.add(i); ret out; }