static Substring joinSubstringObjects(Iterable l) { Iterator it = iterator(l); if (!it.hasNext()) null; Substring s = it.next(); while (it.hasNext()) { Substring b = it.next(); if (s.s != b.s) fail("Substrings have different base string"); if (s.endIndex() != b.startIndex()) fail("Substrings don't fit: " + s.range() + " / " + b.range()); s = Substring(s.s, s.startIndex(), s.length()+b.length()); } ret s; }