List<WordBlock> () { boolean hasEqualWords = false; for (Range range : myIterable.iterateUnchanged()) { int count = range.end1 - range.start1; for (int i = 0; i < count; i++) { int index1 = range.start1 + i; int index2 = range.start2 + i; if (isNewline(myWords1, index1) && isNewline(myWords2, index2)) { // split by matched newlines addLineChunk(index1, index2, hasEqualWords); hasEqualWords = false; } else { if (isFirstInLine(myWords1, index1) && isFirstInLine(myWords2, index2)) { // split by matched first word in line addLineChunk(index1 - 1, index2 - 1, hasEqualWords); hasEqualWords = false; } // TODO: split by 'last word in line' + 'last word in whole sequence' ? hasEqualWords = true; } } } addLineChunk(myWords1.size(), myWords2.size(), hasEqualWords); if (pendingChunk != null) myResult.add(pendingChunk.block); return myResult; }