Scala Library
|
|
scala/collection/immutable/IntMap.scala
]
sealed abstract
class
IntMap[+T]
extends
Map[Int, T] with
ImmutableMapTemplate[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. |
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 | |
hashCode, withDefault, withDefaultValue |
Methods inherited from ImmutableMapTemplate | |
+, ++, ++, transform, filterNot |
Methods inherited from MapTemplate | |
newBuilder, contains, isDefinedAt, keySet, keys, valueIterable, values, default, filterKeys, mapValues, mapElements, addString, equals, toString |
Methods inherited from Subtractable | |
-, --, -- |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from Iterable | |
companion |
Methods inherited from IterableTemplate | |
elements, foldRight, reduceRight, toIterable, head, takeRight, dropRight, sameElements, toStream, view, view, first, firstOption, toSeq, projection |
Methods inherited from TraversableClass | |
genericBuilder, unzip, flatten, transpose |
Methods inherited from TraversableTemplate | |
thisCollection, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filterMap, remove, partition, groupBy, forall, exists, count, find, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, headOption, tail, last, lastOption, init, take, drop, slice, takeWhile, dropWhile, span, splitAt, copyToBuffer, copyToArray, copyToArray, toArray, toSequence, toSet, mkString, mkString, mkString, addString, addString |
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.override
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 removedkey
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.final
def
firstKey : Int
final
def
lastKey : Int
Scala Library
|
|