List<LineFragment> (@NotNull List<? extends LineFragment> lineFragments, @NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull ComparisonPolicy policy, @NotNull InnerFragmentsPolicy fragmentsPolicy, @NotNull ProgressIndicator indicator) { List<LineFragment> result = new ArrayList<>(lineFragments.size()); int tooBigChunksCount = 0; for (LineFragment fragment : lineFragments) { assert fragment.getInnerFragments() == null; try { // Do not try to build fine blocks after few fails boolean tryComputeDifferences = tooBigChunksCount < DiffConfig.MAX_BAD_LINES; result.addAll(createInnerFragments(fragment, text1, text2, policy, fragmentsPolicy, indicator, tryComputeDifferences)); } catch (DiffTooBigException e) { result.add(fragment); tooBigChunksCount++; } } return result; }