Scala Library
|
|
class
MutableList[A]
extends
LinearSeq[A] with
LinearSeqLike[A, MutableList[A]] with
Builder[A, MutableList[A]]
This class is used internally to represent mutable lists. It is the
basis for the implementation of the classes
Stack
, and Queue
.
Value Summary | |
protected var
|
first0 : LinkedList[A] |
protected var
|
last0 : LinkedList[A] |
protected var
|
len : Int |
Method Summary | |
def
|
+=
(elem : A) : MutableList[A]
Appends a single element to this buffer. This takes constant time.
|
protected def
|
appendElem (elem : A) : Unit |
override def
|
apply
(n : Int) : A
Returns the
n th element of this list. |
def
|
clear
: Unit
Clear the contents of this builder
|
def
|
get
(n : Int) : Option[A]
Returns the
n th element of this list or None
if index does not exist. |
override def
|
head
: A
Returns the first element in this list
|
override def
|
isEmpty
: Boolean
Is the list empty?
|
override def
|
iterator
: Iterator[A]
Returns an iterator over all elements of this list.
|
override def
|
last
: A
The last element of this linear sequence.
|
override def
|
length
: Int
Returns the length of this list.
|
protected[this] override def
|
newBuilder
: MutableList[A]
The builder that builds instances of CC[A]
|
protected def
|
prependElem (elem : A) : Unit |
def
|
reset : Unit |
def
|
result
: MutableList[A]
Returns collection resulting from this builder. The buffer's contents
are undefined afterwards.
|
override def
|
tail
: MutableList[A]
Returns the rest of this list
|
override def
|
toList
: List[A]
Returns an instance of
scala.List containing the same
sequence of elements. |
def
|
update
(n : Int, x : A) : Unit
Updates the
n th element of this list to a new value. |
Methods inherited from Builder | |
sizeHint, mapResult |
Methods inherited from Growable | |
+=, ++=, ++= |
Methods inherited from LinearSeq | |
companion |
Methods inherited from LinearSeqLike | |
thisCollection, toCollection, foreach, forall, exists, count, find, foldLeft, foldRight, reduceLeft, reduceRight, take, drop, dropRight, slice, takeWhile, span, sameElements, lengthCompare, isDefinedAt, segmentLength, indexWhere, lastIndexWhere |
Methods inherited from SeqLike | |
size, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reverse, reverseMap, reverseIterator, reversedElements, startsWith, startsWith, endsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, view, view, hashCode, equals, toString, findLastIndexOf, equalsWith, containsSlice, projection |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from IterableLike | |
elements, toIterable, takeRight, copyToArray, zip, zipAll, zipWithIndex, toStream, canEqual, first, firstOption |
Methods inherited from GenericTraversableTemplate | |
genericBuilder, unzip, flatten, transpose |
Methods inherited from TraversableLike | |
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, /:, :\, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, lastOption, init, dropWhile, splitAt, copyToBuffer, copyToArray, toArray, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix, withFilter |
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Value Details |
Method Details |
protected[this] override
def
newBuilder : MutableList[A]
override
def
isEmpty : Boolean
override
def
head : A
override
def
tail : MutableList[A]
override
def
length : Int
n
th element of this list.IndexOutofBoundsException -
if index does not exist.n
th element of this list to a new value.IndexOutofBoundsException -
if index does not exist.n
th element of this list or None
if index does not exist.
def
reset : Unit
override
def
last : A
scala.List
containing the same
sequence of elements.
def
+=(elem : A) : MutableList[A]
elem -
the element to append.
def
clear : Unit
def
result : MutableList[A]
Scala Library
|
|