Scala Library
|
|
scala/collection/immutable/IntMap.scala
]
sealed abstract
class
IntMap[+T]
extends
Map[Int, T]Method Summary | |
override def
|
++
[S >: T](that : Iterable[(Int, S)]) : IntMap[S]
Add a sequence of key/value pairs to this map.
|
def
|
-
(key : Int) : IntMap[T]
Remove a key from this 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.
|
def
|
elements
: Iterator[(Int, T)]
Iterator over key, value pairs of the map in unsigned order of the keys.
|
def
|
empty
[S] : IntMap[S]
This method returns a new map instance of the same class
mapping keys of the same type to values of type
C . |
override def
|
filter
(f : ((Int, T)) => Boolean) : IntMap[T]
This method removes all the mappings for which the predicate
p returns false . |
override final def
|
foreach
(f : ((Int, T)) => Unit) : 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 if it exists. |
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?
|
override def
|
keys
: Iterator[Int]
Creates an iterator for all keys.
|
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) |
final def
|
size
: Int
Compute the number of key-to-value mappings.
|
override def
|
stringPrefix
: java.lang.String
Defines the prefix of this object's
toString representation. |
override def
|
toList
: List[(Int, T)]
Returns a list containing all of the elements in this iterable object.
|
override def
|
transform
[S](f : (Int, T) => S) : IntMap[S]
This function transforms all the values of mappings contained
in this map with function
f . |
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.
|
def
|
update
[S >: T](key : Int, value : S) : IntMap[S]
This method allows one to create a new map with an
additional mapping from
key
to value . If the map contains already a
mapping for key , it will be overridden by this
function. |
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
|
values
: Iterator[T]
Creates an iterator for a contained values.
|
Methods inherited from Map | |
+, +, ++, -, --, --, withDefault, withDefaultValue, +, incl, incl, excl, excl, mappingToString |
Methods inherited from Map | |
contains, isDefinedAt, keySet, equals, hashCode, toString, default, projection, filterKeys, mapElements |
Methods inherited from Collection | |
toArray |
Methods inherited from Iterable | |
concat, ++, map, flatMap, partition, takeWhile, dropWhile, take, drop, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, hasDefiniteSize |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
C
.f -
The loop bodyf -
The loop bodyoverride
def
stringPrefix : java.lang.String
toString
representation.override
def
isEmpty : Boolean
true
iff the map is empty.p
returns false
.p -
A prediacte over key-value pairsf
.f -
A function over keys and valuesfinal
def
size : Int
key
to a value and return the
value if it exists.key -
the key of the mapping of interestkey
to a value.
Return that value if it exists, otherwise return default
.key -
the keykey
to value
. If the map contains already a
mapping for key
, it will be overridden by this
function.key -
...value -
...+({A, B})
insteadthis.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 removedkey
it is returned unchanged. Otherwise, return a new map
without a binding for key
f(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.kvs -
the iterable object containing all key/value pairs.
Scala Library
|
|