Skip to content

Commit 25c0e8f

Browse files
authored
Merge pull request scala/scala#7022 from szeiger/issue/11046
Fix inserting at length-1 in `ArrayDeque#insertAll`
2 parents 9ecaee1 + ee1042d commit 25c0e8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/src/scala/collection/mutable/ArrayDeque.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ArrayDeque[A] protected (
165165
val n = length
166166
if (idx == 0) {
167167
prependAll(elems)
168-
} else if (idx == n - 1) {
168+
} else if (idx == n) {
169169
addAll(elems)
170170
} else {
171171
// Get both an iterator and the length of the source (by copying the source to an IndexedSeq if needed)

0 commit comments

Comments
 (0)