From e5c566eee9cfeb4ab1a51a946ce7feb99b2ca95b Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Thu, 5 Sep 2024 09:09:20 +0200 Subject: [PATCH] Update array from extension --- .../scala/collection/compat/PackageShared.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala b/compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala index d89033b6..8d811e20 100644 --- a/compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala +++ b/compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala @@ -362,7 +362,10 @@ private[compat] trait PackageShared { class ArrayExtensions(private val fact: Array.type) extends AnyVal { def from[A: ClassTag](source: TraversableOnce[A]): Array[A] = - fact.apply(source.toSeq: _*) + source match { + case it: Iterable[A] => it.toArray[A] + case _ => source.toIterator.toArray[A] + } } class ImmutableSortedMapExtensions(private val fact: i.SortedMap.type) extends AnyVal {