@@ -113,7 +113,7 @@ object ArrayOps {
113
113
b.result()
114
114
}
115
115
116
- def flatMap [BS , B ](f : A => BS )(implicit asIterable : BS => Iterable [B ], m : ClassTag [B ]): Array [B ] =
116
+ def flatMap [BS , B ](f : A => BS )(implicit asIterable : BS => Iterable [B ], m : ClassTag [B ]): Array [B ] =
117
117
flatMap[B ](x => asIterable(f(x)))
118
118
119
119
/** Creates a new non-strict filter which combines this filter with the given predicate. */
@@ -505,7 +505,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
505
505
*
506
506
* @return a pair of arrays: the first one made of those values returned by `f` that were wrapped in [[scala.util.Left ]],
507
507
* and the second one made of those wrapped in [[scala.util.Right ]]. */
508
- def partitionMap [A1 : ClassTag , A2 : ClassTag ](f : A => Either [A1 , A2 ]): (Array [A1 ], Array [A2 ]) = {
508
+ def partitionMap [A1 : ClassTag , A2 : ClassTag ](f : A => Either [A1 , A2 ]): (Array [A1 ], Array [A2 ]) = {
509
509
val res1 = ArrayBuilder .make[A1 ]
510
510
val res2 = ArrayBuilder .make[A2 ]
511
511
var i = 0
@@ -816,7 +816,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
816
816
* }}}
817
817
*
818
818
*/
819
- def scanLeft [B : ClassTag ](z : B )(op : (B , A ) => B ): Array [B ] = {
819
+ def scanLeft [ B : ClassTag ](z : B )(op : (B , A ) => B ): Array [B ] = {
820
820
var v = z
821
821
var i = 0
822
822
val res = new Array [B ](xs.length + 1 )
@@ -855,7 +855,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
855
855
* }}}
856
856
*
857
857
*/
858
- def scanRight [B : ClassTag ](z : B )(op : (A , B ) => B ): Array [B ] = {
858
+ def scanRight [ B : ClassTag ](z : B )(op : (A , B ) => B ): Array [B ] = {
859
859
var v = z
860
860
var i = xs.length - 1
861
861
val res = new Array [B ](xs.length + 1 )
@@ -973,7 +973,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
973
973
b.result()
974
974
}
975
975
976
- def flatMap [BS , B ](f : A => BS )(implicit asIterable : BS => Iterable [B ], m : ClassTag [B ]): Array [B ] =
976
+ def flatMap [BS , B ](f : A => BS )(implicit asIterable : BS => Iterable [B ], m : ClassTag [B ]): Array [B ] =
977
977
flatMap[B ](x => asIterable(f(x)))
978
978
979
979
/** Flattens a two-dimensional array by concatenating all its rows
@@ -1095,7 +1095,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
1095
1095
* If this array is shorter than `that`, `thisElem` values are used to pad the result.
1096
1096
* If `that` is shorter than this array, `thatElem` values are used to pad the result.
1097
1097
*/
1098
- def zipAll [A1 >: A , B ](that : Iterable [B ], thisElem : A1 , thatElem : B ): Array [(A1 , B )] = {
1098
+ def zipAll [A1 >: A , B ](that : Iterable [B ], thisElem : A1 , thatElem : B ): Array [(A1 , B )] = {
1099
1099
val b = new ArrayBuilder .ofRef[(A1 , B )]()
1100
1100
val k = that.knownSize
1101
1101
b.sizeHint(max(k, xs.length))
@@ -1244,7 +1244,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
1244
1244
* @return a pair of Arrays, containing, respectively, the first and second half
1245
1245
* of each element pair of this Array.
1246
1246
*/
1247
- def unzip [A1 , A2 ](implicit asPair : A => (A1 , A2 ), ct1 : ClassTag [A1 ], ct2 : ClassTag [A2 ]): (Array [A1 ], Array [A2 ]) = {
1247
+ def unzip [A1 , A2 ](implicit asPair : A => (A1 , A2 ), ct1 : ClassTag [A1 ], ct2 : ClassTag [A2 ]): (Array [A1 ], Array [A2 ]) = {
1248
1248
val a1 = new Array [A1 ](xs.length)
1249
1249
val a2 = new Array [A2 ](xs.length)
1250
1250
var i = 0
@@ -1273,7 +1273,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
1273
1273
* @return a triple of Arrays, containing, respectively, the first, second, and third
1274
1274
* elements from each element triple of this Array.
1275
1275
*/
1276
- def unzip3 [A1 , A2 , A3 ](implicit asTriple : A => (A1 , A2 , A3 ), ct1 : ClassTag [A1 ], ct2 : ClassTag [A2 ],
1276
+ def unzip3 [A1 , A2 , A3 ](implicit asTriple : A => (A1 , A2 , A3 ), ct1 : ClassTag [A1 ], ct2 : ClassTag [A2 ],
1277
1277
ct3 : ClassTag [A3 ]): (Array [A1 ], Array [A2 ], Array [A3 ]) = {
1278
1278
val a1 = new Array [A1 ](xs.length)
1279
1279
val a2 = new Array [A2 ](xs.length)
@@ -1418,7 +1418,7 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
1418
1418
* @tparam K the type of keys returned by the discriminator function
1419
1419
* @tparam B the type of values returned by the transformation function
1420
1420
*/
1421
- def groupMap [K , B : ClassTag ](key : A => K )(f : A => B ): immutable.Map [K , Array [B ]] = {
1421
+ def groupMap [K , B : ClassTag ](key : A => K )(f : A => B ): immutable.Map [K , Array [B ]] = {
1422
1422
val m = mutable.Map .empty[K , ArrayBuilder [B ]]
1423
1423
val len = xs.length
1424
1424
var i = 0
@@ -1479,7 +1479,8 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
1479
1479
/** Create a copy of this array with the specified element type. */
1480
1480
def toArray [B >: A : ClassTag ]: Array [B ] = {
1481
1481
val destination = new Array [B ](xs.length)
1482
- copyToArray(destination, 0 )
1482
+ @ annotation.unused val copied = copyToArray(destination, 0 )
1483
+ // assert(copied == xs.length)
1483
1484
destination
1484
1485
}
1485
1486
0 commit comments