Scala Library
|
|
scala/collection/immutable/TreeMap.scala
]
class
TreeMap[A, +B](val override
size : Int, t : Tree[B], val implicit
ordering : Ordering[A])
extends
RedBlack[A] with
SortedMap[A, B] with
SortedMapLike[A, B, TreeMap[A, B]] with
MapLike[A, B, TreeMap[A, B]]Additional Constructor Summary | |
def
|
this
()(implicit ordering : Ordering[A]) : TreeMap[A, B]
|
Value Summary | |
protected val
|
tree : Tree[B] |
Method Summary | |
override def
|
+
[B1 >: B](elem1 : (A, B1), elem2 : (A, B1), elems : (A, B1)*) : TreeMap[A, B1]
Adds two or more elements to this collection and returns
either the collection itself (if it is mutable), or a new collection
with the added elements.
|
override def
|
+
[B1 >: B](kv : (A, B1)) : TreeMap[A, B1]
Add a key/value pair to this map.
|
def
|
-
(key : A) : TreeMap[A, B]
Removes a key from this map, returning a new map
|
override def
|
compare
(k0 : A, k1 : A) : Int
Comparison function that orders keys.
|
override def
|
empty
: TreeMap[A, B]
A factory to create empty maps of the same type of keys.
|
override def
|
firstKey
: A
Returns the first key of the collection.
|
override def
|
foreach
[U](f : ((A, B)) => U) : Unit
Apply a function
f to all elements of this
iterable object. |
override def
|
get
(key : A) : Option[B]
Check if this map maps
key to a value and return the
value if it exists. |
def
|
insert
[B1 >: B](key : A, value : B1) : TreeMap[A, B1]
A new TreeMap with the entry added is returned,
assuming that key is not in the TreeMap.
|
def
|
isSmaller (x : A, y : A) : Boolean |
def
|
iterator
: Iterator[(A, B)]
Creates a new iterator over all elements contained in this
object.
|
override def
|
lastKey
: A
Returns the last key of the collection.
|
protected[this] override def
|
newBuilder
: Builder[(A, B), TreeMap[A, B]]
A common implementation of `newBuilder` for all maps in terms of `empty`.
Overridden for mutable maps in `mutable.MapLike`.
|
override def
|
rangeImpl
(from : Option[A], until : Option[A]) : TreeMap[A, B]
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.
|
override def
|
toStream
: Stream[(A, B)]
Returns a stream with all elements in this iterable object.
|
override def
|
updated
[B1 >: B](key : A, value : B1) : TreeMap[A, B1]
A new TreeMap with the entry added is returned,
if key is not in the TreeMap, otherwise
the key is updated with the new entry.
|
Methods inherited from SortedMap | |
++, ++ |
Methods inherited from SortedMapLike | |
keySet |
Methods inherited from Sorted | |
from, until, range, to, hasAll |
Methods inherited from Map | |
withDefault, withDefaultValue |
Methods inherited from MapLike | |
transform, filterNot, update |
Methods inherited from MapLike | |
isEmpty, getOrElse, apply, contains, isDefinedAt, keysIterator, keys, valuesIterable, valuesIterator, values, default, filterKeys, mapValues, mapElements, addString, stringPrefix, toString, hashCode, equals |
Methods inherited from Subtractable | |
-, --, -- |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from Iterable | |
companion |
Methods inherited from IterableLike | |
thisCollection, toCollection, elements, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, canEqual, view, view, first, firstOption, projection |
Methods inherited from GenericTraversableTemplate | |
genericBuilder, unzip, flatten, transpose |
Methods inherited from TraversableLike | |
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, withFilter |
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Additional Constructor Details |
Value Details |
Method Details |
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.override
def
firstKey : A
override
def
lastKey : A
key -
...value -
...kv -
the key/value pairelem1 -
the first element to add.elem2 -
the second element to add.elems -
the remaining elements to add.key -
the key to be removedkey
key
to a value and return the
value if it exists.key -
the key of the mapping of interestf
to all elements of this
iterable object.f -
A function that is applied for its side-effect to every element. The result (of arbitrary type U) of function `f` is discarded.
Scala Library
|
|