Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package scala.collection.compat.immutable
import java.util.Arrays

import scala.annotation.unchecked.uncheckedVariance
import scala.collection.AbstractSeq
import scala.collection.{AbstractSeq, IndexedSeqOptimized}
import scala.collection.generic._
import scala.collection.immutable.IndexedSeq
import scala.collection.mutable.{ArrayBuilder, Builder, WrappedArrayBuilder}
Expand All @@ -34,7 +34,10 @@ import scala.util.hashing.MurmurHash3
* @define mayNotTerminateInf
* @define willNotTerminateInf
*/
abstract class ArraySeq[+T] extends AbstractSeq[T] with IndexedSeq[T] {
abstract class ArraySeq[+T]
extends AbstractSeq[T]
with IndexedSeq[T]
with IndexedSeqOptimized[T, ArraySeq[T]] {

override protected[this] def thisCollection: ArraySeq[T] = this

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ class ArraySeqTest {
Assert.assertEquals(ArraySeq[T](), array.slice(1, 1))
Assert.assertEquals(ArraySeq[T](), array.slice(2, 1))
}

@Test def ArraySeqIndexedSeqOptimized(): Unit = {
val x = ArraySeq(1, 2)
val y = ArraySeq(3, 4)
val z: ArraySeq[Int] = x ++ y
assert(z.toList == List(1, 2, 3, 4))
}
}