|
Scala Library Documentation
|
|
final
class
ListBuffer[A]
extends Buffer[A]ListBuffer ..| Method Summary | |
def
|
+:
(x : A) : Buffer[A]
Prepends a single element to this buffer.
|
override def
|
+=
(x : A) : Unit
Appends a single element to this buffer.
|
def
|
-
(x : A) : Buffer[A]
Removes a single element from the buffer and return
the identity of the buffer. Same as
this -= x; this |
override def
|
-=
(x : A) : Unit
Remove a single element from this buffer.
|
def
|
apply
(n : Int) : A
Returns the n-th element of this list. This method
yields an error if the element does not exist.
|
def
|
clear
: Unit
Clears the buffer contents.
|
override def
|
clone
: Buffer[A]
Returns a clone of this buffer.
|
override def
|
elements
: Iterator[A]
Returns an iterator over all elements of this list.
Note: the iterator can be affected by insertions, updates and
deletions that are performed afterwards on the buffer. To get
iterator an over the current buffer snapshot, use
|
override def
|
equals
(obj : Any) : Boolean
Checks if two buffers are structurally identical.
|
def
|
insertAll
(n : Int, iter : Iterable[A]) : Unit
Inserts new elements at the index
n. Opposed to method
update, this method will not replace an element with a new
one. Instead, it will insert a new element at index n. |
def
|
length
: Int
Returns the length of this buffer.
|
def
|
prependToList
(xs : List[A]) : List[A]
Prepends the elements of this buffer to a given list
|
def
|
remove
(n : Int) : A
Removes the element on a given index position.
|
protected override def
|
stringPrefix
: String
Defines the prefix of the string representation.
|
override def
|
toList
: List[A]
Converts this buffer to a list
|
def
|
update
(n : Int, x : A) : Unit
Replaces element at index
n with the new element
newelem. |
| Methods inherited from Buffer | |
| +, ++=, ++=, ++=, ++, ++, ++:, append, appendAll, prepend, prependAll, insert, trimStart, trimEnd, <<, hashCode |
| Methods inherited from Seq | |
| size, isEmpty, concat, ++, isDefinedAt, lastIndexOf, map, flatMap, filter, take, drop, takeWhile, dropWhile, reverse, contains, slice, subseq, toArray |
| Methods inherited from Collection | |
| toString |
| Methods inherited from Iterable | |
| foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, mkString, mkString, addString, addString, copyToArray, projection, hasDefiniteSize |
| Methods inherited from PartialFunction | |
| orElse, andThen |
| Methods inherited from Function1 | |
| compose |
| Methods inherited from AnyRef | |
| getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Method Details |
x - the element to prepend.x - the element to append.this -= x; thisx - the element to remove.x - the element to remove.xs - the list to which elements are prepended
def
clear : Unit
def
length : Int
n - the position of the element to be returned.n with the new element
newelem.n - the index of the element to replace.x - the new element.n is out of bounds.n. Opposed to method
update, this method will not replace an element with a new
one. Instead, it will insert a new element at index n.n - the index where a new element will be inserted.iter - the iterable object providing all elements to insert.n is out of bounds.n - the index which refers to the element to delete.n.nn is out of bounds.Returns an iterator over all elements of this list.
Note: the iterator can be affected by insertions, updates and
deletions that are performed afterwards on the buffer. To get
iterator an over the current buffer snapshot, use
toList.elements.
ListBuffer with the same elements.true, iff both buffers contain the same sequence of elements.protected override
def
stringPrefix : String
|
Scala Library Documentation
|
|