Skip to content

Commit

Permalink
refactor: remove unnecessary list copying
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd committed Jun 5, 2024
1 parent 0121c61 commit 37933be
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,8 @@ public class DiffRowGenerator(
val origList = inlineDiffSplitter.split(joinedOrig)
val revList = inlineDiffSplitter.split(joinedRev)

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

for (inlineDelta in inlineDeltas) {
val inlineOrig = inlineDelta.source
Expand Down

0 comments on commit 37933be

Please sign in to comment.