|
Scala Library
|
|
scala/collection/immutable/IntMap.scala]
sealed abstract
class
IntMap[+T]
extends Map[Int, T] with MapLike[Int, T, IntMap[T]]| Method Summary | |
def
|
+
[S >: T](kv : (Int, S)) : IntMap[S]
Add a key/value pair to this map, returning a new map.
|
def
|
++ [S >: T](that : IntMap[S]) : IntMap[S] |
def
|
-
(key : Int) : IntMap[T]
Removes a key from this map, returning a new map
|
override final def
|
apply
(key : Int) : T
Retrieve the value which is associated with the given key. This
method throws an exception if there is no mapping from the given
key to a value.
|
override def
|
empty : IntMap[T] |
override def
|
filter
(f : ((Int, T)) => Boolean) : IntMap[T]
Returns all the elements of this traversable that satisfy the
predicate
p. The order of the elements is preserved. |
final def
|
firstKey
: Int
The entry with the lowest key value considered in unsigned order.
|
override final def
|
foreach
[U](f : ((Int, T)) => U) : Unit
Loops over the key, value pairs of the map in unsigned order of the keys.
|
final def
|
foreachKey
(f : (Int) => Unit) : Unit
Loop over the keys of the map. The same as keys.foreach(f), but may
be more efficient.
|
final def
|
foreachValue
(f : (T) => Unit) : Unit
Loop over the keys of the map. The same as keys.foreach(f), but may
be more efficient.
|
final def
|
get
(key : Int) : Option[T]
Check if this map maps
key to a value and return the
value as an option if it exists, None if not. |
override final def
|
getOrElse
[S >: T](key : Int, default : => S) : S
Check if this map maps
key to a value.
Return that value if it exists, otherwise return default. |
def
|
intersection
[R](that : IntMap[R]) : IntMap[T]
Left biased intersection. Returns the map that has all the same mappings as this but only for keys
which are present in the other map.
|
def
|
intersectionWith
[S, R](that : IntMap[S], f : (Int, T, S) => R) : IntMap[R]
Forms the intersection of these two maps with a combinining function. The resulting map is
a map that has only keys present in both maps and has values produced from the original mappings
by combining them with f.
|
override def
|
isEmpty
: Boolean
Is this an empty map?
|
def
|
iterator
: Iterator[(Int, T)]
Iterator over key, value pairs of the map in unsigned order of the keys.
|
override def
|
keysIterator
: Iterator[Int]
Creates an iterator for all keys.
|
final def
|
lastKey
: Int
The entry with the highest key value considered in unsigned order.
|
def
|
modifyOrRemove
[S](f : (Int, T) => Option[S]) : IntMap[S]
A combined transform and filter function. Returns an IntMap such that for each (key, value) mapping
in this map, if f(key, value) == None the map contains no mapping for key, and if
f(key, value) |
override final def
|
size
: Int
The number of elements in this collection
|
override def
|
stringPrefix
: java.lang.String
Defines the prefix of this object's
toString representation.
!!! todo: remove stringPrefix overrides where possible |
override def
|
toList
: List[(Int, T)]
Returns a list with all elements of this traversable object.
|
def
|
transform [S](f : (Int, T) => S) : IntMap[S] |
def
|
unionWith
[S >: T](that : IntMap[S], f : (Int, S, S) => S) : IntMap[S]
Forms a union map with that map, using the combining function to resolve conflicts.
|
override def
|
update [S >: T](key : Int, value : S) : IntMap[S] |
def
|
updateWith
[S >: T](key : Int, value : S, f : (T, S) => S) : IntMap[S]
Updates the map, using the provided function to resolve conflicts if the key is already present.
Equivalent to
this.get(key) match {
case None => this.update(key, value);
case Some(oldvalue) => this.update(key, f(oldvalue, value) }
|
override def
|
updated
[S >: T](key : Int, value : S) : IntMap[S]
Add a key/value pair to this map.
|
override def
|
valuesIterator
: Iterator[T]
Creates an iterator for a contained values.
|
| Methods inherited from Map | |
| withDefault, withDefaultValue |
| Methods inherited from MapLike | |
| +, ++, ++, transform, filterNot |
| Methods inherited from MapLike | |
| newBuilder, contains, isDefinedAt, keySet, keys, valuesIterable, values, default, filterKeys, mapValues, mapElements, addString, 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, toStream, canEqual, view, view, first, firstOption, projection |
| Methods inherited from GenericTraversableTemplate | |
| genericBuilder, unzip, flatten, transpose |
| Methods inherited from TraversableLike | |
| repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, 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, 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 |
| Method Details |
f - The loop bodyf - The loop bodyoverride
def
stringPrefix : java.lang.String
toString representation.
!!! todo: remove stringPrefix overrides where possibleoverride
def
isEmpty : Boolean
true iff the map does not contain any key/value mapping.p. The order of the elements is preserved.p - the predicate used to filter the traversable.p.override final
def
size : Int
key to a value and return the
value as an option if it exists, None if not.key - the key of the mapping of interest.key to a value.
Return that value if it exists, otherwise return default.key - the key.default - a computation that yields a default value in case no binding for the key is found in the map.key - the keykv - the key/value pairkey - the keyvalue - the valuethis.get(key) match {
case None => this.update(key, value);
case Some(oldvalue) => this.update(key, f(oldvalue, value) }
key - The key to updatevalue - The value to use if there is no conflictf - The function used to resolve conflicts.key - the key to be removedkeyf(key, value)f - The transforming function.that - the map to form a union with.f - the function used to resolve conflicts between two mappings.that - The map to intersect with.f - The combining function.that - The map to intersect with.final
def
firstKey : Int
final
def
lastKey : Int
|
Scala Library
|
|