Package net.cscott.jutil
Class HashEnvironment<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
net.cscott.jutil.HashEnvironment<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 aHashEnvironment.HashEnvironment(Map<? extends K, ? extends V> m) Creates aHashEnvironmentwith all the mappings in the given map. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all mappings.booleancontainsKey(Object key) Returnstrueif this map contains a mapping for the specified key.entrySet()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.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 number 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, isEmpty, 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, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
Constructor Details
-
HashEnvironment
public HashEnvironment()Creates aHashEnvironment. -
HashEnvironment
Creates aHashEnvironmentwith all the mappings in the given map.
-
-
Method Details
-
containsKey
Returnstrueif this map contains a mapping for the specified key.- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
Returns the value to which this map maps the specified key. -
put
Associates the specified value with the specified key in this map. -
remove
Removes the mapping for this key from this map if present. -
size
public int size()Returns the number of key-value mappings in this map. -
clear
public void clear()Clears all mappings. -
getMark
Description copied from interface:EnvironmentGet a mark that will allow you to restore the current state of this environment.- Specified by:
getMarkin interfaceEnvironment<K,V>
-
undoToMark
Description copied from interface:EnvironmentUndo all changes since the supplied mark, restoring the map to its state at the time the mark was taken. The undoToMark() operation must be repeatable.- Specified by:
undoToMarkin interfaceEnvironment<K,V>
-
entrySet
-