final class ImmArray[+A] extends AnyRef

Simple immutable array. The intention is that all the operations have the "obvious" operational behavior (like Vector in haskell).

Functions that slice the ImmArray (including head, tail, etc) are all constant time -- they keep referring to the same underlying array.

Note that we _very intentionally_ do _not_ make this an instance of any sorts of Seq, since using Seq encourages patterns where the performance of what you're doing is totally unclear. Use toSeq if you want a Seq, and think about what that means.

Self Type
ImmArray[A]
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ImmArray
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(idx: Int): A

    O(1), crashes on out of bounds

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def canEqual(that: Any): Boolean

    O(1)

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  8. def collect[B](f: PartialFunction[A, B]): ImmArray[B]

    O(n)

  9. def copyToArray[B >: A](xs: Array[B]): Int

    O(n)

  10. def copyToArray[B >: A](dst: Array[B], dstStart: Int, dstLen: Int): Int

    O(n)

  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(that: Any): Boolean

    O(n)

    O(n)

    Definition Classes
    ImmArray → AnyRef → Any
  13. def filter(f: (A) => Boolean): ImmArray[A]

    O(n)

  14. def find(f: (A) => Boolean): Option[A]

    O(n)

  15. def foldLeft[B](z: B)(f: (B, A) => B): B

    O(n)

  16. def foldRight[B](z: B)(f: (A, B) => B): B

    O(n)

  17. def foreach(f: (A) => Unit): Unit

    O(n)

  18. def get(idx: Int): Option[A]

    O(1)

  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  20. def hashCode(): Int
    Definition Classes
    ImmArray → AnyRef → Any
  21. def head: A

    O(1), crashes on empty list

  22. def indexWhere(p: (A) => Boolean): Int

    O(n)

  23. def indices: Range

    O(1)

  24. def init: ImmArray[A]

    O(1), crashes on empty list

  25. def isEmpty: Boolean

    O(1)

  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. def iterator: Iterator[A]
  28. def last: A

    O(1), crashes on empty list

  29. val length: Int
  30. def map[B](f: (A) => B): ImmArray[B]

    O(n)

  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. def nonEmpty: Boolean

    O(1)

  33. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  34. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  35. def relaxedSlice(from0: Int, until0: Int): ImmArray[A]

    O(1), like strictSlice, but does not crash on out of bounds errors -- follows the same semantics as Seq's slice.

  36. def reverse: ImmArray[A]

    O(n)

  37. def reverseIterator: Iterator[A]
  38. def slowAppend[B >: A](other: ImmArray[B]): ImmArray[B]

    O(n+m)

    O(n+m)

    If you find using this a lot, consider using another data structure (maybe FrontQueue or BackQueue), since to append ImmArray we must copy both of them.

  39. def slowCons[B >: A](el: B): ImmArray[B]

    O(n)

    O(n)

    If you find yourself using this a lot, consider using another data structure, since to cons an ImmArray we must copy it.

  40. def slowSnoc[B >: A](el: B): ImmArray[B]

    O(n)

    O(n)

    If you find yourself using this a lot, consider using another data structure, since to snoc an ImmArray we must copy it.

  41. def strictSlice(from: Int, until: Int): ImmArray[A]

    O(1)

    O(1)

    Returns all the elements at indices ix where from <= ix < until.

    Crashes if: * from < 0 || from >= length * until < 0 || until > length

    Note that this crashing behavior is _not_ consistent with Seq's behavior of not crashing but rather returning an empty array. If you want Seq's behavior, use relaxedSlice.

  42. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  43. def tail: ImmArray[A]

    O(1), crashes on empty list

  44. def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]

    O(n)

  45. def toFrontStack: FrontStack[A]
  46. def toIndexedSeq: ImmArraySeq[A]

    O(1).

    O(1).

    Note: very important that this is a scala.collection.immutable.IndexedSeq, and not a possibly mutable scala.collection.IndexedSeq, otherwise we could return the array as is and people would be able to break the original ImmArray.

  47. def toList: List[A]

    O(n)

  48. def toSeq: ImmArraySeq[A]

    O(1)

    O(1)

    Note: very important that this is a scala.collection.immutable.IndexedSeq, and not a possibly mutable scala.collection.IndexedSeq, otherwise we could return the array as is and people would be able to break the original ImmArray.

  49. def toString(): String

    O(n)

    O(n)

    Definition Classes
    ImmArray → AnyRef → Any
  50. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  51. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  52. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  53. def zip[B](that: ImmArray[B]): ImmArray[(A, B)]

    O(min(n, m))

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped