LineFragment (@NotNull LineFragment fragment, @NotNull BitSet ignored1, @NotNull BitSet ignored2) { if (fragment.getInnerFragments() == null) return fragment; int startOffset1 = fragment.getStartOffset1(); int startOffset2 = fragment.getStartOffset2(); List<DiffFragment> newInner = ContainerUtil.mapNotNull(fragment.getInnerFragments(), it -> { TextRange range1 = trimIgnoredRange(it.getStartOffset1(), it.getEndOffset1(), ignored1, startOffset1); TextRange range2 = trimIgnoredRange(it.getStartOffset2(), it.getEndOffset2(), ignored2, startOffset2); if (range1.isEmpty() && range2.isEmpty()) return null; return new DiffFragmentImpl(range1.getStartOffset(), range1.getEndOffset(), range2.getStartOffset(), range2.getEndOffset()); }); if (newInner.isEmpty()) return null; return new LineFragmentImpl(fragment, newInner); }