You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//def arrayToNonEmptyArray(array: Array[T]): NonEmptyArray[T] = new NonEmptyArray[T](array)
575
+
574
576
/**
575
577
* Partitions this <code>NonEmptyArray</code> into a map of <code>NonEmptyArray</code>s according to some discriminator function.
576
578
*
@@ -586,9 +588,9 @@ final class NonEmptyArray[T] private (val toArray: Array[T]) extends AnyVal {
586
588
* That is, every key <code>k</code> is bound to a <code>NonEmptyArray</code> of those elements <code>x</code> for which <code>f(x)</code> equals <code>k</code>.
valmapKToArray= toArray.toList.groupBy(f)// toList and implicit ClassTag is required to compile in scala 2.10.
593
+
mapKToArray.mapValues{ list =>newNonEmptyArray(list.toArray) }
592
594
}
593
595
594
596
/**
@@ -597,9 +599,9 @@ final class NonEmptyArray[T] private (val toArray: Array[T]) extends AnyVal {
597
599
* @paramsize the number of elements per group
598
600
* @return An iterator producing <code>NonEmptyArray</code>s of size <code>size</code>, except the last will be truncated if the elements don't divide evenly.
finaldefsliding(size: Int)(implicitclassTag: ClassTag[T]):Iterator[NonEmptyArray[T]] = toArray.toList.sliding(size).map(l =>newNonEmptyArray(l.toArray)) // toList and implicit ClassTag is required to compile in scala 2.10.
1240
1242
1241
1243
/**
1242
1244
* Groups elements in fixed size blocks by passing a “sliding window” over them (as opposed to partitioning them, as is done in grouped.),
@@ -1247,7 +1249,7 @@ final class NonEmptyArray[T] private (val toArray: Array[T]) extends AnyVal {
1247
1249
* @return an iterator producing <code>NonEmptyArray</code>s of size <code>size</code>, except the last and the only element will be truncated
1248
1250
* if there are fewer elements than <code>size</code>.
0 commit comments