// Finds out the index of a sublist in the original list // Works with nested (grand-parent) sublists. // Does not work with lists not made with subList() (returns -1) static int magicIndexOfSubList(L list, L sublist) { Int o2 = cast get(sublist, "offset"); if (o2 == null) ret -1; Int o1 = cast getOpt(list, "offset"); ret o2-(o1 != null ? o1 : 0); }