scala.collection.immutable

class LongMap

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

sealed abstract class LongMap[+T]
extends Map[Long, T]
Specialised immutable map structure for long keys, based on Fast Mergeable Long Maps by Okasaki and Gill. Essentially a trie based on binary digits of the the integers.
Method Summary
override def ++ [S >: T](that : Iterable[(Long, S)]) : LongMap[S]
Add a sequence of key/value pairs to this map.
def - (key : Long) : LongMap[T]
Remove a key from this map
override final def apply (key : Long) : 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[(Long, T)]
Iterator over key, value pairs of the map in unsigned order of the keys.
def empty [S] : LongMap[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 : ((Long, T)) => Boolean) : LongMap[T]
This method removes all the mappings for which the predicate p returns false.
override final def foreach (f : ((Long, T)) => Unit) : Unit
Loops over the key, value pairs of the map in unsigned order of the keys.
final def foreachKey (f : (Long) => 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 : Long) : 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 : Long, 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 : LongMap[R]) : LongMap[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 : LongMap[S], f : (Long, T, S) => R) : LongMap[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[Long]
Creates an iterator for all keys.
def modifyOrRemove [S](f : (Long, T) => Option[S]) : LongMap[S]
A combined transform and filter function. Returns an LongMap 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[(Long, T)]
Returns a list containing all of the elements in this iterable object.
override def transform [S](f : (Long, T) => S) : LongMap[S]
This function transforms all the values of mappings contained in this map with function f.
def unionWith [S >: T](that : LongMap[S], f : (Long, S, S) => S) : LongMap[S]
Forms a union map with that map, using the combining function to resolve conflicts.
def update [S >: T](key : Long, value : S) : LongMap[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 : Long, value : S, f : (T, S) => S) : LongMap[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
def empty[S] : LongMap[S]
This method returns a new map instance of the same class mapping keys of the same type to values of type C.
Overrides
Map.empty

override def toList : List[(Long, T)]
Returns a list containing all of the elements in this iterable object.
Notes
Will not terminate for infinite-sized collections.

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

override final def foreach(f : ((Long, T)) => Unit) : Unit
Loops over the key, value pairs of the map in unsigned order of the keys.

override def keys : Iterator[Long]
Creates an iterator for all keys.
Returns
an iterator over all keys.

final def foreachKey(f : (Long) => 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 values : 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 is empty.

override def filter(f : ((Long, T)) => Boolean) : LongMap[T]
This method removes all the mappings for which the predicate p returns false.
Parameters
p - A prediacte over key-value pairs
Returns
the updated map
Overrides
Map.filter

override def transform[S](f : (Long, T) => S) : LongMap[S]
This function transforms all the values of mappings contained in this map with function f.
Parameters
f - A function over keys and values
Returns
the updated map
Overrides
Map.transform

final def size : Int
Compute the number of key-to-value mappings.
Returns
the number of mappings

final def get(key : Long) : Option[T]
Check if this map maps key to a value and return the value if it exists.
Parameters
key - the key of the mapping of interest
Returns
the value of the mapping, if it exists

override final def getOrElse[S >: T](key : Long, default : => S) : S
Check if this map maps key to a value. Return that value if it exists, otherwise return default.

override final def apply(key : Long) : 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 update[S >: T](key : Long, value : S) : LongMap[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.
Parameters
key - ...
value - ...
Returns
the created map
Deprecated
use +({A, B}) instead
Overrides
Map.update

def updateWith[S >: T](key : Long, value : S, f : (T, S) => S) : LongMap[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 : Long) : LongMap[T]
Remove a key from this map
Parameters
key - the key to be removed
Returns
If the map does not contain a binding for key it is returned unchanged. Otherwise, return a new map without a binding for key
Overrides
Map.-

def modifyOrRemove[S](f : (Long, T) => Option[S]) : LongMap[S]
A combined transform and filter function. Returns an LongMap 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 : LongMap[S], f : (Long, S, S) => S) : LongMap[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 : LongMap[S], f : (Long, T, S) => R) : LongMap[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 : LongMap[R]) : LongMap[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.

override def ++[S >: T](that : Iterable[(Long, S)]) : LongMap[S]
Add a sequence of key/value pairs to this map.
Parameters
kvs - the iterable object containing all key/value pairs.
Returns
A new map with the new bindings added
Overrides
Map.++