public class PersistentMap<K,V>
extends java.lang.Object
implements java.io.Serializable
PersistentMap implements a persistent map, based on a
persistent randomized treap. Unlike the Maps returned
by PersistentMapFactory, PersistentMap
does not implement that standard Map API
but instead exposes the underlying functional operations.| Constructor and Description |
|---|
PersistentMap()
Creates an empty
PersistentMap whose
key objects will all implement Comparable. |
PersistentMap(java.util.Comparator<K> c)
Creates an empty
PersistentMap whose
key objects are ordered by the given Comparator. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<K,V> |
asMap()
Collections view of the mapping. |
PersistentMap<K,V> |
clone()
Cloning takes constant time, regardless of the size of the map.
|
boolean |
containsKey(K key)
Determines if there is a mapping for the given
key. |
V |
get(K key)
Gets the value which
key maps to. |
int |
hashCode() |
boolean |
isEmpty()
Determines if this
PersistentMap has any mappings. |
PersistentMap<K,V> |
put(K key,
V value)
Creates and returns a new
PersistentMap identical to
this one, except it contains a mapping from key to
value. |
PersistentMap<K,V> |
putAll(PersistentMap<K,V> map)
Put all the mappings in the given map into this map, throwing
out conflicting mappings from this set as necessary.
|
PersistentMap<K,V> |
remove(K key)
Make a new
PersistentMap identical to this one,
except that it does not contain a mapping for key. |
int |
size()
Count the number of key->value mappings in this
PersistentMap. |
java.lang.String |
toString()
Human-readable representation of the map.
|
public PersistentMap()
PersistentMap whose
key objects will all implement Comparable.
Note that good hashcode implementations for the key objects are
still required.public PersistentMap(java.util.Comparator<K> c)
PersistentMap whose
key objects are ordered by the given Comparator.
Note that good hashcode implementations for the key objects are
still required.public boolean isEmpty()
PersistentMap has any mappings.public int size()
PersistentMap.public PersistentMap<K,V> put(K key, V value)
PersistentMap identical to
this one, except it contains a mapping from key to
value.public boolean containsKey(K key)
key.public PersistentMap<K,V> remove(K key)
PersistentMap identical to this one,
except that it does not contain a mapping for key.public PersistentMap<K,V> putAll(PersistentMap<K,V> map)
public PersistentMap<K,V> clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright (c) 2006 C. Scott Ananian