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]
- Note
In most cases a
,Chaincan be used as a drop-in replacement for a standard Scala List.Some core methods, e.g.
dropandtake, 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,Chaindoes not inherit fromscala...Seq.
- Alphabetic
- By Inheritance
- Chain
- Serializable
- Serializable
- FilterMonadic
- TraversableOnce
- GenTraversableOnce
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
class
ChainWithFilter extends FilterMonadic[T, Chain[T]]
Represents a filtered Chain.
Represents a filtered Chain. Instances of ChainWithFilter are typically created by Chain's
withFiltermethod.
Abstract Value Members
-
abstract
def
:&::[X >: T](x: Chain[X]): Chain[X]
Prepends the given
Chaintothischain. - abstract def drop(n: Int): Chain[T]
- abstract def filter(f: (T) ⇒ Boolean): Chain[T]
-
abstract
def
fuse[X >: T <: AnyRef](that: Chain[X], onDiff: (T, X) ⇒ X): Chain[X]
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
onDiffis 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. - abstract def hasMultipleElements: Boolean
- abstract def head: T
- abstract def headOption: Option[T]
-
abstract
def
isEmpty: Boolean
- Definition Classes
- TraversableOnce → GenTraversableOnce
- abstract def isSingletonList: Boolean
- abstract def mapConserve[X >: T <: AnyRef](f: (T) ⇒ X): Chain[X]
-
abstract
def
merge[X <: AnyRef, Z >: T <: AnyRef](that: Chain[X])(f: (T, X) ⇒ Z): Chain[Z]
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. - abstract def reverse: Chain[T]
- abstract def tail: Chain[T]
-
abstract
def
take(n: Int): Chain[T]
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.
-
abstract
def
takeUpTo(n: Int): Chain[T]
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.sizeelements.- n
An int value euqal or larger than 0.
- returns
A list consisting of the first n value.
- abstract def takeWhile(f: (T) ⇒ Boolean): Chain[T]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def ++[X >: T](other: Traversable[X]): Chain[X]
- def ++[X >: T](that: Chain[X]): Chain[X]
-
def
/:[B](z: B)(op: (B, T) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
:&:(x: Int)(implicit ev: <:<[Chain.this.type, Chain[Int]]): Chain[Int]
Prepends the given
intvalue to this Chain if this chain is a chain of int values. -
def
:&:[X >: T](x: X): Chain[X]
Prepends the given element to this Chain.
-
def
:\[B](z: B)(op: (T, B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addString(b: StringBuilder): StringBuilder
- Definition Classes
- TraversableOnce
-
def
addString(b: StringBuilder, sep: String): StringBuilder
- Definition Classes
- TraversableOnce
-
def
addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
- Definition Classes
- TraversableOnce
-
def
aggregate[B](z: ⇒ B)(seqop: (B, T) ⇒ B, combop: (B, B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
apply(index: Int): T
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].
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
collectFirst[B](pf: PartialFunction[T, B]): Option[B]
- Definition Classes
- TraversableOnce
- def contains[X >: T](e: X): Boolean
-
def
copyToArray[B >: T](xs: Array[B], start: Int, len: Int): Unit
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
copyToArray[B >: T](xs: Array[B]): Unit
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
copyToArray[B >: T](xs: Array[B], start: Int): Unit
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
copyToBuffer[B >: T](dest: Buffer[B]): Unit
- Definition Classes
- TraversableOnce
-
def
corresponds[X](other: Chain[X])(f: (T, X) ⇒ Boolean): Boolean
- See also
merge
-
def
count(p: (T) ⇒ Boolean): Int
- Definition Classes
- TraversableOnce → GenTraversableOnce
- def dropWhile(f: (T) ⇒ Boolean): Chain[T]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists(f: (T) ⇒ Boolean): Boolean
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
- def filterNot(f: (T) ⇒ Boolean): Chain[T]
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find(p: (T) ⇒ Boolean): Option[T]
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
flatMap[B, That](f: (T) ⇒ GenTraversableOnce[B])(implicit bf: CanBuildFrom[Chain[T], B, That]): That
- Definition Classes
- Chain → FilterMonadic
-
def
fold[A1 >: T](z: A1)(op: (A1, A1) ⇒ A1): A1
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
foldLeft[B](z: B)(op: (B, T) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
foldRight[B](z: B)(op: (T, B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
- def forFirstN[U](n: Int)(f: (T) ⇒ U): Unit
-
def
forall(f: (T) ⇒ Boolean): Boolean
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
foreach[U](f: (T) ⇒ U): Unit
- Definition Classes
- Chain → FilterMonadic → TraversableOnce → GenTraversableOnce
-
def
foreachWhile(f: (T) ⇒ Boolean): Boolean
Executes the given function
ffor each element of this chain as long as it returnstrue. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
hasDefiniteSize: Boolean
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isTraversableAgain: Boolean
- Definition Classes
- Chain → GenTraversableOnce
- def last: T
-
def
map[B, That](f: (T) ⇒ B)(implicit bf: CanBuildFrom[Chain[T], B, That]): That
- Definition Classes
- Chain → FilterMonadic
- def mapToIntIterator(f: (T) ⇒ Int): IntIterator
-
def
max[B >: T](implicit cmp: Ordering[B]): T
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
maxBy[B](f: (T) ⇒ B)(implicit cmp: Ordering[B]): T
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
min[B >: T](implicit cmp: Ordering[B]): T
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
minBy[B](f: (T) ⇒ B)(implicit cmp: Ordering[B]): T
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
mkString(pre: String, sep: String, post: String): String
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
mkString: String
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
mkString(sep: String): String
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
nonEmpty: Boolean
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
product[B >: T](implicit num: Numeric[B]): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduce[A1 >: T](op: (A1, A1) ⇒ A1): A1
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceLeft[B >: T](op: (B, T) ⇒ B): B
- Definition Classes
- TraversableOnce
-
def
reduceLeftOption[B >: T](op: (B, T) ⇒ B): Option[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceOption[A1 >: T](op: (A1, A1) ⇒ A1): Option[A1]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceRight[B >: T](op: (T, B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceRightOption[B >: T](op: (T, B) ⇒ B): Option[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reversed: List[T]
- Attributes
- protected[this]
- Definition Classes
- TraversableOnce
-
final
def
seq: Chain.this.type
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
sharedPrefix[X >: T](other: Chain[X]): Chain[T]
Computes the shared prefix.
-
def
size: Int
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).
-
def
sizeHintIfCheap: Int
- Attributes
- protected[scala.collection]
- Definition Classes
- GenTraversableOnce
- def startsWith[X >: T](other: Chain[X]): Boolean
-
def
sum[B >: T](implicit num: Numeric[B]): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
to[Col[_]](implicit cbf: CanBuildFrom[Nothing, T, Col[T]]): Col[T]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toArray[B >: T](implicit arg0: ClassTag[B]): Array[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toBuffer[B >: T]: Buffer[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toIndexedSeq: IndexedSeq[T]
- Definition Classes
- TraversableOnce → GenTraversableOnce
- def toIntArraySet(implicit ev: <:<[T, Int]): IntArraySet
- def toIntTrieSet(implicit ev: <:<[T, Int]): IntTrieSet
-
def
toIterable: Iterable[T]
- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
toIterator: Iterator[T]
- Definition Classes
- Chain → GenTraversableOnce
-
def
toList: List[T]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toMap[T, U](implicit ev: <:<[T, (T, U)]): Map[T, U]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toSeq: Seq[T]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toSet[B >: T]: Set[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toStream: Stream[T]
- Definition Classes
- Chain → GenTraversableOnce
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
toTraversable: Traversable[T]
Returns a newly created
Traversable[T]collection.Returns a newly created
Traversable[T]collection.- Definition Classes
- Chain → TraversableOnce → GenTraversableOnce
-
def
toVector: Vector[T]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
withFilter(p: (T) ⇒ Boolean): ChainWithFilter
- Definition Classes
- Chain → FilterMonadic
- def zip[X](other: Chain[X]): Chain[(T, X)]
- def zip[X](other: GenIterable[X]): Chain[(T, X)]
- def zipWithIndex: Chain[(T, Int)]