Skip to content

Commit 0b9c017

Browse files
committed
Make add all also recive Arrays
These call use `java.lang.System.arraycopy` to add the elements
1 parent 46c0540 commit 0b9c017

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

library/src/scala/collection/mutable/IArrayBuilder.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ sealed abstract class IArrayBuilder[T]
1717
def clear(): Unit = arrayBuilder.clear()
1818

1919
/** Add all elements of an array */
20-
def addAll(xs: IArray[T]): this.type =
20+
def addAll(xs: IArray[T] | Array[_ <: T]): this.type =
2121
arrayBuilder.addAll(xs.asInstanceOf[Array[T]])
2222
this
2323

2424
/** Add a slice of an array */
25-
def addAll(xs: IArray[T], offset: Int, length: Int): this.type =
25+
def addAll(xs: IArray[T] | Array[_ <: T], offset: Int, length: Int): this.type =
2626
arrayBuilder.addAll(xs.asInstanceOf[Array[T]], offset, length)
2727
this
2828

tests/run/IArrayOps.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
@main def Test: Unit =
22
val iarr1 = IArray(1, 2, 3)
33
val iarr2 = IArray(5, 4, 5, 6)
4-
// val iarr3 = IArray(
5-
// IArray(1, 2, 3),
6-
// IArray(4, 5, 6),
7-
// IArray(7, 8, 9)
8-
// )
94

105
println(iarr1.toSeq)
116
println(iarr1.contains(1))

0 commit comments

Comments
 (0)