Skip to content

Commit 37933be

Browse files
committed
refactor: remove unnecessary list copying
1 parent 0121c61 commit 37933be

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/commonMain/kotlin/io/github/petertrr/diffutils/text/DiffRowGenerator.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,8 @@ public class DiffRowGenerator(
278278
val origList = inlineDiffSplitter.split(joinedOrig)
279279
val revList = inlineDiffSplitter.split(joinedRev)
280280

281-
// Copying of `origList` and `revList` is needed because otherwise `wrapInTag` results in ConcurrentModificationException
282-
val diff = diff(origList.toMutableList(), revList.toMutableList(), equalizer)
283-
val inlineDeltas = diff.deltas.asReversed().toMutableList()
281+
val diff = diff(origList, revList, equalizer)
282+
val inlineDeltas = diff.deltas.reversed()
284283

285284
for (inlineDelta in inlineDeltas) {
286285
val inlineOrig = inlineDelta.source

0 commit comments

Comments
 (0)