Concatenate two Chains.
Concatenate two Chains.
This is a fast O(1) operation: it simply returns a new Chain.Concat instance wrapping the arguments.
Prepend a value to a Chain.
Prepend a value to a Chain.
(a +: x) is equivalent to (Chain.single(a) ++ x).
Append a value to a Chain.
Append a value to a Chain.
(x :+ a) is equivalent to (x ++ Chain.single(a)).
Compare two Chain instances.
Compare two Chain instances.
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.
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.
Return whether the predicate is true for any elements or not.
Return whether the predicate is true for any elements or not.
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.
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.
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.
Combine the elements of a Chain into a single value, using a starter value and an associative function.
Combine the elements of a Chain into a single value, using a starter value and an associative function.
Return whether the predicate is true for all elements or not.
Return whether the predicate is true for all elements or not.
Loop over this Chain, applying the given function.
Loop over this Chain, applying the given function.
This is an O(n) operation.
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).
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).
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.
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.
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.
Conver this Chain to a Vector.
Conver this Chain to a Vector.
This is an O(n) operation.