sealed abstract class Chain[+A] extends AnyRef
Chain wraps Iterable[A] instances to enable fast concatenation and traversal.
- Alphabetic
- By Inheritance
- Chain
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
++[A1 >: A](that: Chain[A1]): Chain[A1]
Concatenate two Chains.
Concatenate two Chains.
This is a fast O(1) operation: it simply returns a new Chain.Concat instance wrapping the arguments.
-
def
+:[A1 >: A](a: A1): Chain[A1]
Prepend a value to a Chain.
Prepend a value to a Chain.
(a +: x) is equivalent to (Chain.single(a) ++ x).
-
def
:+[A1 >: A](a: A1): Chain[A1]
Append a value to a Chain.
Append a value to a Chain.
(x :+ a) is equivalent to (x ++ Chain.single(a)).
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
compare[A1 >: A](that: Chain[A1])(implicit ev: Ordering[A1]): Int
Compare two Chain instances.
-
def
compress: Chain[A]
Compress a Chain, removing its internal structure.
Compress a Chain, removing its internal structure.
In general, this is an O(n) operation which will compact this Chain into a single Chain.Elems instance wrapping a vector. However, if the Chain is already compressed (i.e. Chain.Elems) this does not do any work or allocate a new Chain.
When working with a large number of very small collections, this method can have a big impact.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(that: Any): Boolean
Universal equality for Chain.
Universal equality for Chain.
In the worst-case this is an O(n) operation, but may be faster due to type mistmatches or finding unequal elements early in the Chains.
- Definition Classes
- Chain → AnyRef → Any
-
def
exists(p: (A) ⇒ Boolean): Boolean
Return whether the predicate is true for any elements or not.
-
def
filter(p: (A) ⇒ Boolean): Chain[A]
Filter out some elements of a Chain given a predicate.
Filter out some elements of a Chain given a predicate.
This is an O(n) operation.
The resulting Chain will naturally be compressed.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find(p: (A) ⇒ Boolean): Option[A]
Search for the first element that satisfies the given predicate.
Search for the first element that satisfies the given predicate.
In the worst-case this is an O(n) operation, but it will short-circuit as soon as a single match is found.
-
def
flatMap[B](f: (A) ⇒ Chain[B]): Chain[B]
Translate a Chain using the given function.
Translate a Chain using the given function.
This is an O(n * m) operation, where n is the length of this Chain and m represents the average length of the Chain instances produced by f.
-
def
foldLeft[B](b: B)(f: (B, A) ⇒ B): B
Combine the elements of a Chain into a single value, using a starter value and an associative function.
-
def
forall(p: (A) ⇒ Boolean): Boolean
Return whether the predicate is true for all elements or not.
-
def
foreach(f: (A) ⇒ Unit): Unit
Loop over this Chain, applying the given function.
Loop over this Chain, applying the given function.
This is an O(n) operation.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
Hash codes for Chain.
Hash codes for Chain.
This is an O(n) operation. It is consistent with equals. This means that if (x == y) then (x.hashCode == y.hashCode).
- Definition Classes
- Chain → AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
iterator: Iterator[A]
Return an iterator over the contents of this Chain.
Return an iterator over the contents of this Chain.
This is a fast O(1) operation, although traversing the iterator is itself an O(n) operation (which also uses O(n) heap).
-
def
map[B](f: (A) ⇒ B): Chain[B]
Translate a Chain using the given function.
Translate a Chain using the given function.
This is an O(n) operation.
The resulting Chain will naturally be compressed.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toIterable: Iterable[A]
Allow this Chain to be used where Iterable[A] is required.
Allow this Chain to be used where Iterable[A] is required.
By default Chain does not extend Iterable[A], to avoid inheriting inefficient methods from that API.
This is a fast O(1) operation.
-
def
toString(): String
Produce a string representation of this Chain.
Produce a string representation of this Chain.
This is an O(n) operation, which will display the entire contents of the Chain.
- Definition Classes
- Chain → AnyRef → Any
-
def
toVector: Vector[A]
Conver this Chain to a Vector.
Conver this Chain to a Vector.
This is an O(n) operation.
-
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( ... )