scala.collection.immutable

class IntMap

[source: scala/collection/immutable/IntMap.scala]

sealed abstract class IntMap[+T]
extends Map[Int, T] with ImmutableMapTemplate[Int, T, IntMap[T]]
Specialised immutable map structure for integer keys, based on Fast Mergeable Integer Maps by Okasaki and Gill. Essentially a trie based on binary digits of the the integers.
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
override def empty : IntMap[T]
Overrides
Map.empty

override def toList : List[(Int, T)]
Returns a list with all elements of this traversable object.
Notes
Will not terminate for infinite-sized collections.

def iterator : Iterator[(Int, T)]
Iterator over key, value pairs of the map in unsigned order of the keys.

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.

override def keysIterator : Iterator[Int]
Creates an iterator for all keys.
Returns
an iterator over all 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.
Parameters
f - The loop body

override def valuesIterator : Iterator[T]
Creates an iterator for a contained values.
Returns
an iterator over all values.

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.
Parameters
f - The loop body

override def stringPrefix : java.lang.String
Defines the prefix of this object's toString representation.

override def isEmpty : Boolean
Is this an empty map?
Returns
true iff the map does not contain any key/value mapping.

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.
Parameters
p - the predicate used to filter the traversable.
Returns
the elements of this traversable satisfying p.

def transform[S](f : (Int, T) => S) : IntMap[S]

override final def size : Int
The number of elements in this collection

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.
Parameters
key - the key of the mapping of interest.
Returns
the value of the mapping as an option, if it exists, or None.

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.
Parameters
key - the key.
default - a computation that yields a default value in case no binding for the key is found in the 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.
Parameters
key - the key
Returns
the value associated with the given key.

def +[S >: T](kv : (Int, S)) : IntMap[S]
Add a key/value pair to this map, returning a new map.
Parameters
kv - the key/value pair
Returns
A new map with the new binding added to this map
Overrides
Map.+, ImmutableMapTemplate.+

override def updated[S >: T](key : Int, value : S) : IntMap[S]
Add a key/value pair to this map.
Parameters
key - the key
value - the value
Returns
A new map with the new binding added to this map
Overrides
Map.updated, ImmutableMapTemplate.updated

@deprecated("use `updated' instead")

override def update[S >: T](key : Int, value : S) : IntMap[S]
Overrides
ImmutableMapTemplate.update

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) }
   
Parameters
key - The key to update
value - The value to use if there is no conflict
f - The function used to resolve conflicts.

def -(key : Int) : IntMap[T]
Removes a key from this map, returning a new map
Parameters
key - the key to be removed
Returns
A new map without a binding for key

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)
Parameters
f - The transforming function.

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.
Parameters
that - the map to form a union with.
f - the function used to resolve conflicts between two mappings.

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.
Parameters
that - The map to intersect with.
f - The combining function.

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.
Parameters
that - The map to intersect with.

def ++[S >: T](that : IntMap[S]) : IntMap[S]

final def firstKey : Int
The entry with the lowest key value considered in unsigned order.

final def lastKey : Int
The entry with the highest key value considered in unsigned order.