Scala Library
|
|
scala/collection/jcl/Buffer.scala
]
trait
Buffer[A]
extends
Mutable[A] with
Ranged[Int, A] with
MutableSeq[A] with
Collection[A]Type Summary | |
protected final type
|
SortedSelf |
Method Summary | |
override def
|
+
(a : A) : Buffer[A]
adds "a" from the collection. Useful for chaining.
|
override def
|
-=
(a : A) : Unit
removes "a" from the collection.
|
def
|
add
(idx : Int, a : A) : Unit
Inserts "a" into this buffer just before the element at index "idx."
|
def
|
add (a : A) : Boolean |
def
|
addAll
(idx : Int, that : Iterable[A]) : Unit
Inserts all elements of
that into this buffer just before
the element at index idx . |
final def
|
compare
(k0 : Int, k1 : Int) : Int
Indices are compared through subtraction.
|
override def
|
elements
: BufferIterator[Int, A]
The default implementation of a map over mutable iterable collections.
|
override def
|
firstKey
: Int
The first index of a buffer is 0.
|
override def
|
isEmpty
: Boolean
Returns true if length == 0
|
override def
|
lastKey
: Int
The last index of a buffer is its size - 1.
|
override def
|
projection
: Projection[A]
returns a projection that can be used to call non-strict
filter ,
map , and flatMap methods that build projections
of the collection. |
override def
|
rangeImpl
(from : Option[Int], until : Option[Int]) : Buffer[A]
Creates a ranged projection of this collection. Any mutations in the
ranged projection will update this collection and vice versa. Note: keys
are not garuanteed to be consistent between this collection and the projection.
This is the case for buffers where indexing is relative to the projection.
|
def
|
remove
(idx : Int, length : Int) : Unit
Removes N elements from index
idx |
def
|
remove
(idx : Int) : A
Removes the element at index
idx |
def
|
replace
(from : Int, length : Int, added : Seq[A]) : Unit
replaces
|
def
|
set
(idx : Int, a : A) : A
Replaces the element at index "idx" with "a."
|
override def
|
transform
(f : (A) => A) : Boolean
Transforms each element of the collection in-place according to
f . |
def
|
update
(idx : Int, a : A) : Unit
Equivalent to set except the replaced element is not returned.
|
Methods inherited from Collection | |
hasAll, addAll, ++, += |
Methods inherited from MutableSeq | |
apply, indexOf, length |
Methods inherited from Ranged | |
from, until, range |
Methods inherited from MutableIterable | |
has, remove, removeAll, --, -, retainOnly, retainAll, size0, clear |
Methods inherited from Mutable | |
readOnly, drop, take, slice, reverse |
Methods inherited from RandomAccessSeq | |
partition, patch, ++, toStream, safeIs |
Methods inherited from Seq | |
lengthCompare, size, concat, last, lastOption, first, firstOption, headOption, isDefinedAt, lastIndexOf, findIndexOf, indexOf, map, flatMap, filter, slice, takeWhile, dropWhile, contains, subseq, toArray, toSeq, equalsWith, startsWith, startsWith, endsWith, indexOf, containsSlice |
Methods inherited from Collection | |
toString, stringPrefix |
Methods inherited from Iterable | |
foreach, forall, exists, find, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, mkString, addString, addString, addString, copyToArray, hasDefiniteSize |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Class Summary | |
protected class
|
DefaultBufferIterator
extends DefaultSeqIterator with BufferIterator[Int, A]
|
protected class
|
Range
(val from : Option[Int], val until : Option[Int]) extends Buffer[A]
|
Type Details |
Method Details |
override
def
projection : Projection[A]
filter
,
map
, and flatMap
methods that build projections
of the collection.override
def
elements : BufferIterator[Int, A]
override
def
firstKey : Int
override
def
lastKey : Int
idx
idx
that
into this buffer just before
the element at index idx
.idx -
..that -
..f
.f -
true
if the collection is actually updated.override
def
isEmpty : Boolean
from -
The lower-bound (inclusive) of the ranged projection. None
if there is no lower bound.until -
The upper-bound (exclusive) of the ranged projection. None
if there is no upper bound.
Scala Library
|
|