scala.collection.immutable

class UnbalancedTreeMap

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

@serializable

class UnbalancedTreeMap[A, +B](implicit view$2 : (A) => Ordered[A])
extends Map[A, B]
This class implements immutable maps using a tree.
Author
Martin Odersky
Version
1.1, 02/01/2007
Direct Known Subclasses:
UnbalancedTreeMap.Node

Method Summary
def - (key : A) : UnbalancedTreeMap[A, B]
Remove a key from this map
protected def add [B1 >: B](key : A, value : B1) : Node[B1]
override def apply (key : A) : B
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[(A, B)]
Creates a new iterator over all elements contained in this object.
def empty [C] : UnbalancedTreeMap[A, C]
A factory to create empty maps of the same type of keys.
protected def findValue (key : A) : UnbalancedTreeMap[A, B]
override def get (key : A) : Option[B]
Check if this map maps key to a value and return the value if it exists.
def insert [B1 >: B](key : A, value : B1) : Node[B1]
A new TreeMap with the entry added is returned, assuming that key is not in the TreeMap.
override def isEmpty : Boolean
Is this an empty map?
protected def key : A
def size : Int
Compute the number of key-to-value mappings.
protected def smallest : UnbalancedTreeMap[A, B]
def update [B1 >: B](key : A, value : B1) : Node[B1]
A new TreeMap with the entry added is returned, if key is not in the TreeMap, otherwise the key is updated with the new entry.
protected def value : B
Methods inherited from Map
+, +, ++, ++, -, --, --, withDefault, withDefaultValue, transform, filter, +, incl, incl, excl, excl, mappingToString
Methods inherited from Map
getOrElse, contains, isDefinedAt, keys, keySet, values, equals, hashCode, toString, default, projection, filterKeys, mapElements
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, toStream, mkString, 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 [+B](protected val override key : A, protected val override value : B, left : UnbalancedTreeMap[A, B], right : UnbalancedTreeMap[A, B]) extends UnbalancedTreeMap[A, B]
Method Details
def empty[C] : UnbalancedTreeMap[A, C]
A factory to create empty maps of the same type of keys.
Overrides
Map.empty

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

override def isEmpty : Boolean
Is this an empty map?
Returns
true iff the map is empty.

protected def add[B1 >: B](key : A, value : B1) : Node[B1]

protected def findValue(key : A) : UnbalancedTreeMap[A, B]

protected def key : A

protected def value : B

protected def smallest : UnbalancedTreeMap[A, B]

def update[B1 >: B](key : A, value : B1) : Node[B1]
A new TreeMap with the entry added is returned, if key is not in the TreeMap, otherwise the key is updated with the new entry.
Parameters
key - ...
value - ...
Returns
...
Overrides
Map.update

def insert[B1 >: B](key : A, value : B1) : Node[B1]
A new TreeMap with the entry added is returned, assuming that key is not in the TreeMap.

def -(key : A) : UnbalancedTreeMap[A, B]
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.-

override def get(key : A) : Option[B]
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 def apply(key : A) : B
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.
Throws
Error("key - not found").

def elements : Iterator[(A, B)]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator