scala.collection.immutable

class ListMap

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

@serializable

class ListMap[A, +B]
extends Map[A, B]
This class implements immutable maps using a list-based data structure. Instances of ListMap represent empty maps; they can be either created by calling the constructor directly, or by applying the function ListMap.empty.
Author
Matthias Zenger
Martin Oderskty
Version
2.0, 01/01/2007
Direct Known Subclasses:
ListMap.Node

Method Summary
def - (key : A) : ListMap[A, B]
This creates a new mapping without the given key. If the map does not contain a mapping for the given key, the method returns the same map.
def elements : Iterator[(A, B)]
Returns an iterator over key-value pairs.
def empty [C] : ListMap[A, C]
Returns a new ListMap instance mapping keys of the same type to values of type C.
def get (key : A) : Option[B]
Checks if this map maps key to a value and return the value if it exists.
protected def key : A
protected def next : ListMap[A, B]
def size : Int
Returns the number of mappings in this map.
def update [B1 >: B](key : A, value : B1) : ListMap[A, B1]
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.
protected def value : B
Methods inherited from Map
+, +, ++, ++, -, --, --, withDefault, withDefaultValue, transform, filter, +, incl, incl, excl, excl, mappingToString
Methods inherited from Map
getOrElse, isEmpty, apply, contains, isDefinedAt, keys, keySet, values, equals, hashCode, toString, default, projection
Methods inherited from Collection
toArray, stringPrefix
Methods inherited from Iterable
concat, ++, map, flatMap, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, 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
Class Summary
protected class Node [B1 >: B](protected val override key : A, protected val override value : B1) extends ListMap[A, B1]
Method Details
def empty[C] : ListMap[A, C]
Returns a new ListMap instance mapping keys of the same type to values of type C.
Overrides
Map.empty

def size : Int
Returns the number of mappings in this map.
Returns
number of mappings in this map.

def get(key : A) : Option[B]
Checks 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

def update[B1 >: B](key : A, value : B1) : ListMap[A, B1]
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 - the key element of the updated entry.
value - the value element of the updated entry.
Overrides
Map.update

def -(key : A) : ListMap[A, B]
This creates a new mapping without the given key. If the map does not contain a mapping for the given key, the method returns the same map.
Parameters
key - a map without a mapping for the given key.
Overrides
Map.-

def elements : Iterator[(A, B)]
Returns an iterator over key-value pairs.

protected def key : A

protected def value : B

protected def next : ListMap[A, B]