Trait/Object

org.opalj.collection.immutable

Chain

Related Docs: object Chain | package immutable

Permalink

sealed trait Chain[+T] extends TraversableOnce[T] with FilterMonadic[T, Chain[T]] with Serializable

A linked list which does not perform any length related checks. I.e., it fails in case of drop and take etc. if the size of the list is smaller than expected. Furthermore, all directly implemented methods use while loops for maximum efficiency and the list is also specialized for primitive int values which makes this list far more efficient when used for storing lists of int values.

Self Type
Chain[T]
Source
Chain.scala
Note

Some core methods, e.g. drop and take, have different semantics when compared to the methods with the same name defined by the Scala collections API. In this case these methods may fail arbitrarily if the list is not long enough. Therefore, Chain does not inherit from scala...Seq.

,

In most cases a Chain can be used as a drop-in replacement for a standard Scala List.

Linear Supertypes
Serializable, Serializable, FilterMonadic[T, Chain[T]], TraversableOnce[T], GenTraversableOnce[T], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Chain
  2. Serializable
  3. Serializable
  4. FilterMonadic
  5. TraversableOnce
  6. GenTraversableOnce
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class ChainWithFilter extends FilterMonadic[T, Chain[T]]

    Permalink

    Represents a filtered Chain.

    Represents a filtered Chain. Instances of ChainWithFilter are typically created by Chain's withFilter method.

Abstract Value Members

  1. abstract def :&::[X >: T](x: Chain[X]): Chain[X]

    Permalink

    Prepends the given Chain to this chain.

  2. abstract def drop(n: Int): Chain[T]

    Permalink
  3. abstract def filter(f: (T) ⇒ Boolean): Chain[T]

    Permalink
  4. abstract def fuse[X >: T <: AnyRef](that: Chain[X], onDiff: (T, X) ⇒ X): Chain[X]

    Permalink

    Fuses this chain with the given chain by fusing the values using the given function.

    Fuses this chain with the given chain by fusing the values using the given function. The function onDiff is only called if the given list's element and this list's element differ. Hence, when the tail of both lists is equal fusing both lists will terminate immediately and the common tail is attached to the new heading.

  5. abstract def hasMultipleElements: Boolean

    Permalink
  6. abstract def head: T

    Permalink
  7. abstract def headOption: Option[T]

    Permalink
  8. abstract def isEmpty: Boolean

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  9. abstract def isSingletonList: Boolean

    Permalink
  10. abstract def mapConserve[X >: T <: AnyRef](f: (T) ⇒ X): Chain[X]

    Permalink
  11. abstract def merge[X <: AnyRef, Z >: T <: AnyRef](that: Chain[X])(f: (T, X) ⇒ Z): Chain[Z]

    Permalink

    Merges this chain with the given chain by merging the values using the given function.

    Merges this chain with the given chain by merging the values using the given function. If all results are the same (reference equality) as this chain's elements then the result will be this. Otherwise, only the tail that is identical will be kept.

  12. abstract def reverse: Chain[T]

    Permalink
  13. abstract def tail: Chain[T]

    Permalink
  14. abstract def take(n: Int): Chain[T]

    Permalink

    Takes the first n elements of this list.

    Takes the first n elements of this list. If this list does not contain at least n elements an IllegalStateException will be thrown.

    n

    An int value in the range [0...this.size].

    returns

    A list consisting of the first n value.

  15. abstract def takeUpTo(n: Int): Chain[T]

    Permalink

    Takes up to the first n elements of this list.

    Takes up to the first n elements of this list. The returned list will contain at most this.size elements.

    n

    An int value euqal or larger than 0.

    returns

    A list consisting of the first n value.

  16. abstract def takeWhile(f: (T) ⇒ Boolean): Chain[T]

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++[X >: T <: AnyRef](other: Traversable[X]): Chain[X]

    Permalink
  4. def ++[X >: T](that: Chain[X]): Chain[X]

    Permalink
  5. def /:[B](z: B)(op: (B, T) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  6. def :&:(x: Int)(implicit ev: <:<[Chain.this.type, Chain[Int]]): Chain[Int]

    Permalink

    Prepends the given int value to this Chain if this chain is a chain of int values.

  7. def :&:[X >: T](x: X): Chain[X]

    Permalink

    Prepends the given element to this Chain.

  8. def :\[B](z: B)(op: (T, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  9. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def addString(b: StringBuilder): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  11. def addString(b: StringBuilder, sep: String): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  12. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  13. def aggregate[B](z: ⇒ B)(seqop: (B, T) ⇒ B, combop: (B, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  14. def apply(index: Int): T

    Permalink

    Returns the value of the element of this list with the given index.

    Returns the value of the element of this list with the given index.

    index

    A valid index. A value in the range [0...this.size-1].

  15. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def collectFirst[B](pf: PartialFunction[T, B]): Option[B]

    Permalink
    Definition Classes
    TraversableOnce
  18. def contains[X >: T](e: X): Boolean

    Permalink
  19. def copyToArray[B >: T](xs: Array[B], start: Int, len: Int): Unit

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  20. def copyToArray[B >: T](xs: Array[B]): Unit

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  21. def copyToArray[B >: T](xs: Array[B], start: Int): Unit

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  22. def copyToBuffer[B >: T](dest: Buffer[B]): Unit

    Permalink
    Definition Classes
    TraversableOnce
  23. def corresponds[X](other: Chain[X])(f: (T, X) ⇒ Boolean): Boolean

    Permalink

    See also

    merge

  24. def count(p: (T) ⇒ Boolean): Int

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  25. def dropWhile(f: (T) ⇒ Boolean): Chain[T]

    Permalink
  26. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  28. def exists(f: (T) ⇒ Boolean): Boolean

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  29. def filterNot(f: (T) ⇒ Boolean): Chain[T]

    Permalink
  30. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. def find(p: (T) ⇒ Boolean): Option[T]

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  32. def flatMap[B, That](f: (T) ⇒ GenTraversableOnce[B])(implicit bf: CanBuildFrom[Chain[T], B, That]): That

    Permalink
    Definition Classes
    Chain → FilterMonadic
  33. def fold[A1 >: T](z: A1)(op: (A1, A1) ⇒ A1): A1

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  34. def foldLeft[B](z: B)(op: (B, T) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  35. def foldRight[B](z: B)(op: (T, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  36. def forFirstN[U](n: Int)(f: (T) ⇒ U): Unit

    Permalink
  37. def forall(f: (T) ⇒ Boolean): Boolean

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  38. def foreach[U](f: (T) ⇒ U): Unit

    Permalink
    Definition Classes
    Chain → FilterMonadic → TraversableOnce → GenTraversableOnce
  39. def foreachWhile(f: (T) ⇒ Boolean): Boolean

    Permalink

    Executes the given function f for each element of this chain as long as it returns true.

  40. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  41. final def hasDefiniteSize: Boolean

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  42. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  43. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  44. final def isTraversableAgain: Boolean

    Permalink
    Definition Classes
    Chain → GenTraversableOnce
  45. def last: T

    Permalink
  46. def map[B, That](f: (T) ⇒ B)(implicit bf: CanBuildFrom[Chain[T], B, That]): That

    Permalink
    Definition Classes
    Chain → FilterMonadic
  47. def max[B >: T](implicit cmp: Ordering[B]): T

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  48. def maxBy[B](f: (T) ⇒ B)(implicit cmp: Ordering[B]): T

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  49. def min[B >: T](implicit cmp: Ordering[B]): T

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  50. def minBy[B](f: (T) ⇒ B)(implicit cmp: Ordering[B]): T

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  51. def mkString(pre: String, sep: String, post: String): String

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  52. def mkString: String

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  53. def mkString(sep: String): String

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  54. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  55. def nonEmpty: Boolean

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  56. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  57. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  58. def product[B >: T](implicit num: Numeric[B]): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  59. def reduce[A1 >: T](op: (A1, A1) ⇒ A1): A1

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  60. def reduceLeft[B >: T](op: (B, T) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce
  61. def reduceLeftOption[B >: T](op: (B, T) ⇒ B): Option[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  62. def reduceOption[A1 >: T](op: (A1, A1) ⇒ A1): Option[A1]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  63. def reduceRight[B >: T](op: (T, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  64. def reduceRightOption[B >: T](op: (T, B) ⇒ B): Option[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  65. def reversed: List[T]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    TraversableOnce
  66. final def seq: Chain.this.type

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  67. def sharedPrefix[X >: T](other: Chain[X]): Chain[T]

    Permalink

    Computes the shared prefix.

  68. def size: Int

    Permalink

    Counts the number of elements.

    Counts the number of elements.

    returns

    The size of this list.

    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
    Note

    This operation has complexity O(n).

  69. def startsWith[X >: T](other: Chain[X]): Boolean

    Permalink
  70. def sum[B >: T](implicit num: Numeric[B]): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  71. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  72. def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, T, Col[T]]): Col[T]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  73. def toArray[B >: T](implicit arg0: ClassTag[B]): Array[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  74. def toBuffer[B >: T]: Buffer[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  75. def toIndexedSeq: IndexedSeq[T]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  76. def toIntArraySet(implicit ev: <:<[T, Int]): IntArraySet

    Permalink
  77. def toIterable: Iterable[T]

    Permalink
    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  78. def toIterator: Iterator[T]

    Permalink
    Definition Classes
    Chain → GenTraversableOnce
  79. def toList: List[T]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  80. def toMap[T, U](implicit ev: <:<[T, (T, U)]): Map[T, U]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  81. def toSeq: Seq[T]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  82. def toSet[B >: T]: Set[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  83. def toStream: Stream[T]

    Permalink
    Definition Classes
    Chain → GenTraversableOnce
  84. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  85. def toTraversable: Traversable[T]

    Permalink

    Returns a newly created Traversable[T] collection.

    Returns a newly created Traversable[T] collection.

    Definition Classes
    Chain → TraversableOnce → GenTraversableOnce
  86. def toVector: Vector[T]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  87. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. def withFilter(p: (T) ⇒ Boolean): ChainWithFilter

    Permalink
    Definition Classes
    Chain → FilterMonadic
  91. def zip[X](other: Chain[X]): Chain[(T, X)]

    Permalink
  92. def zip[X](other: GenIterable[X]): Chain[(T, X)]

    Permalink
  93. def zipWithIndex: Chain[(T, Int)]

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from FilterMonadic[T, Chain[T]]

Inherited from TraversableOnce[T]

Inherited from GenTraversableOnce[T]

Inherited from AnyRef

Inherited from Any

Ungrouped