Skip to content

Commit 0208593

Browse files
committed
Update array from extension
1 parent f566425 commit 0208593

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ private[compat] trait PackageShared {
362362

363363
class ArrayExtensions(private val fact: Array.type) extends AnyVal {
364364
def from[A: ClassTag](source: TraversableOnce[A]): Array[A] =
365-
fact.apply(source.toSeq: _*)
365+
source match {
366+
case it: Iterable[A] => it.toArray[A]
367+
case _ => source.toIterator.toArray[A]
368+
}
366369
}
367370

368371
class ImmutableSortedMapExtensions(private val fact: i.SortedMap.type) extends AnyVal {

0 commit comments

Comments
 (0)