strawman.collections.CollectionStrawMan6
Overridden to use array copying for efficiency where possible.
Overridden to use array copying for efficiency where possible.
Bulk append.
Bulk append. Can be overridden if specialized implementations are available.
Append an element
Append an element
The class name of this collection.
The class name of this collection. To be used for converting to string. Collections generally print like this:
<className>(elem_1, ..., elem_n)
The collection itself
The collection itself
Copy all elements of this collection to array xs
, starting at start
.
Copy all elements of this collection to array xs
, starting at start
.
The rest of the collection without its n
first elements.
The rest of the collection without its n
first elements. For
linear, immutable collections this should avoid making a copy.
All elements satisfying predicate p
All elements satisfying predicate p
Flatmap
Flatmap
Fold left
Fold left
Fold right
Fold right
Apply f
to each element for tis side effects
Apply f
to each element for tis side effects
Create a collection of type C[A]
from the elements of coll
, which has
the same element type as this collection.
Create a collection of type C[A]
from the elements of coll
, which has
the same element type as this collection. Overridden in StringOps and ArrayOps.
The first element of the collection.
The first element of the collection.
The index of the first element in this collection for which p
holds.
The index of the first element in this collection for which p
holds.
Is the collection empty?
Is the collection empty?
The number of elements in this collection, if it can be cheaply computed, -1 otherwise.
The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.
Map
Map
A builder resulting from this builder my mapping the result using f
.
A builder resulting from this builder my mapping the result using f
.
A string showing all elements of this collection, separated by string sep
.
A string showing all elements of this collection, separated by string sep
.
Creates a new builder.
Creates a new builder.
Optimized, push-based version of partition
.
Optimized, push-based version of partition
.
Result collection consisting of all elements appended so far.
Result collection consisting of all elements appended so far.
The number of elements in this collection.
The number of elements in this collection. Does not terminate for infinite collections.
The rest of the collection without its first element.
The rest of the collection without its first element.
A collection containing the first n
elements of this collection.
A collection containing the first n
elements of this collection.
Given a collection factory fi
for collections of type constructor C
,
convert this collection to one of type C[A]
.
Given a collection factory fi
for collections of type constructor C
,
convert this collection to one of type C[A]
. Example uses:
xs.to(List) xs.to(ArrayBuffer)
Convert collection to array.
Convert collection to array.
New operation: destructively drop elements at start of buffer.
A view representing the elements of this collection.
A view representing the elements of this collection.
Zip.
Zip. Interesting because it requires to align to source collections.
Concrete collection type: ArrayBuffer