Copying: |
|
xs copyToBuffer buf |
Copies all elements of the collection to buffer |
|
buf. |
xs copyToArray(arr, s, len) |
Copies at most len elements of arr, starting at |
|
index s. The last two arguments are optional. |
Size info: |
|
xs.isEmpty |
Tests whether the collection is empty. |
xs.nonEmpty |
Tests whether the collection contains elements. |
xs.size |
The number of elements in the collection. |
xs.hasDefiniteSize |
True if xs is known to have finite size. |
Element retrieval: |
|
xs.head |
The first element of the collection (or, some |
|
element, if no order is defined). |
xs.headOption |
The first element of xs in an option value, or |
|
None if xs is empty. |
xs.last |
The last element of the collection (or, some |
|
element, if no order is defined). |
xs.lastOption |
The last element of xs in an option value, or None |
|
if xs is empty. |
xs find p |
An option containing the first element in xs that |
|
satisfies p, or None if no element qualifies. |
Subcollections: |
|
xs.tail |
The rest of the collection except xs.head. |
xs.init |
The rest of the collection except xs.last. |
xs slice (from, to) |
A collection consisting of elements in some index |
|
range of xs (from from, up to and excluding to). |
xs take n |
A collection consisting of the first n elements of |
|
xs (or, some arbitrary n elements, if no order is |
|
defined). |
xs drop n |
The rest of the collection except xs take n. |
xs takeWhile p |
The longest prefix of elements in the collection |
|
that all satisfy p. |
xs dropWhile p |
The collection without the longest prefix of |
|
elements that all satisfy p. |