// 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) { Integer o1 = cast getOpt(list, "offset"); if (o1 == null) ret -1; int o2 = (Int) get(sublist, "offset"); ret o2-(o1 != null ? o1 : 0); }