Skip to content

Commit

Permalink
LF: Drop wrong toArraySeq method from ImmArray. (#12163)
Browse files Browse the repository at this point in the history
The method is not correctly implement, as it should slice the
underlying array before returning it. Since it is not possible to
implement it in constant time, we simply drop it, in favor in other
conversion.

CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
remyhaemmerle-da authored Dec 16, 2021
1 parent 101356b commit 39ee326
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import scalaz.{Applicative, Equal, Foldable, Order, Traverse}

import scala.annotation.tailrec
import scala.collection.StrictOptimizedSeqFactory
import scala.collection.immutable.ArraySeq
import scala.collection.immutable.{AbstractSeq, IndexedSeqOps, StrictOptimizedSeqOps}
import scala.collection.immutable.{AbstractSeq, ArraySeq, IndexedSeqOps, StrictOptimizedSeqOps}
import scala.collection.mutable.Builder
import scala.reflect.ClassTag

Expand Down Expand Up @@ -261,9 +260,7 @@ final class ImmArray[+A] private (
* return the `array` as is and people would be able to break the original
* `ImmArray`.
*/
def toSeq: ImmArray.ImmArraySeq[A] = new ImmArray.ImmArraySeq(this)

def toArraySeq: ArraySeq[A] = array
def toSeq: ImmArray.ImmArraySeq[A] = toIndexedSeq

/** O(n) */
def collect[B](f: PartialFunction[A, B]): ImmArray[B] = {
Expand Down

0 comments on commit 39ee326

Please sign in to comment.