|
JUtil | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.cscott.jutil.PersistentMap<K,V>
public class PersistentMap<K,V>
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 Summary | |
|---|---|
PersistentMap()
Creates an empty PersistentMap whose
key objects will all implement Comparable. |
|
PersistentMap(Comparator<K> c)
Creates an empty PersistentMap whose
key objects are ordered by the given Comparator. |
|
| Method Summary | |
|---|---|
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. |
String |
toString()
Human-readable representation of the map. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PersistentMap()
PersistentMap whose
key objects will all implement Comparable.
Note that good hashcode implementations for the key objects are
still required.
public PersistentMap(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.
| Method Detail |
|---|
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 V get(K key)
key maps to.
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 Objectpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic Map<K,V> asMap()
Collections view of the mapping.
|
JUtil | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||