diff --git a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java index f1ec95659f..3a1fc25b0e 100644 --- a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java +++ b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java @@ -195,14 +195,12 @@ private void buildScript(final int start1, final int end1, final int start2, fin script.append(new KeepCommand<>(sequence1.get(i))); ++i; ++j; + } else if (end1 - start1 > end2 - start2) { + script.append(new DeleteCommand<>(sequence1.get(i))); + ++i; } else { - if (end1 - start1 > end2 - start2) { - script.append(new DeleteCommand<>(sequence1.get(i))); - ++i; - } else { - script.append(new InsertCommand<>(sequence2.get(j))); - ++j; - } + script.append(new InsertCommand<>(sequence2.get(j))); + ++j; } }