Package net.cscott.jutil
Class PersistentEnvironment<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
net.cscott.jutil.PersistentEnvironment<K,V>
- All Implemented Interfaces:
Map<K,,V> Environment<K,V>
- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionCreates aPersistentEnvironmentwith no mappings.PersistentEnvironment(Map<K2, V2> m) Creates aPersistentEnvironmentwith the same mappings as the givenMap. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all mappings from this map.booleancontainsKey(Object key) Returnstrueif this map contains a mapping for the specified key.entrySet()Returns a set view of the mappings contained in this map.Returns the value to which this map maps the specified key.getMark()Get a mark that will allow you to restore the current state of this environment.booleanisEmpty()Returnstrueif this map contains no key-value mappings.Associates the specified value with the specified key in this map.Removes the mapping for this key from this map if present.intsize()Returns the numer of key-value mappings in this map.voidUndo all changes since the supplied mark, restoring the map to its state at the time the mark was taken.Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, keySet, putAll, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
Constructor Details
-
PersistentEnvironment
public PersistentEnvironment()Creates aPersistentEnvironmentwith no mappings. -
PersistentEnvironment
Creates aPersistentEnvironmentwith the same mappings as the givenMap.
-
-
Method Details
-
clear
public void clear()Remove all mappings from this map. -
isEmpty
public boolean isEmpty()Returnstrueif this map contains no key-value mappings. -
size
public int size()Returns the numer of key-value mappings in this map. -
get
Returns the value to which this map maps the specified key. -
put
Associates the specified value with the specified key in this map. -
containsKey
Returnstrueif this map contains a mapping for the specified key.- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
remove
Removes the mapping for this key from this map if present. -
getMark
Get a mark that will allow you to restore the current state of this environment.- Specified by:
getMarkin interfaceEnvironment<K,V>
-
undoToMark
Undo all changes since the supplied mark, restoring the map to its state at the time the mark was taken.- Specified by:
undoToMarkin interfaceEnvironment<K,V>
-
entrySet
Returns a set view of the mappings contained in this map. The returned set is immutable.
-