net.cscott.jutil

Class HashEnvironment<K,V>

public class HashEnvironment<K,V> extends AbstractMap<K,V> implements Environment<K,V>

A HashEnvironment is an Environment using a HashMap as the backing store.

Version: $Id: HashEnvironment.java,v 1.2 2004/01/13 21:40:19 cananian Exp $

Author: C. Scott Ananian

Constructor Summary
HashEnvironment()
Creates a HashEnvironment.
<K2 extends K,V2 extends V>HashEnvironment(Map<K2,V2> m)
Creates a HashEnvironment with all the mappings in the given map.
Method Summary
voidclear()
Clears all mappings.
booleancontainsKey(Object key)
Returns true if this map contains a mapping for the specified key.
MapSet<K,V>entrySet()
The Set returned by this method is really a MapSet.
Vget(Object key)
Returns the value to which this map maps the specified key.
Environment.MarkgetMark()
static voidmain(String[] argv)
Self-test function.
Vput(K key, V value)
Associates the specified value with the specified key in this map.
Vremove(Object key)
Removes the mapping for this key from this map if present.
intsize()
Returns the number of key-value mappings in this map.
voidundoToMark(Environment.Mark m)

Constructor Detail

HashEnvironment

public HashEnvironment()
Creates a HashEnvironment.

HashEnvironment

public <K2 extends K,V2 extends V> HashEnvironment(Map<K2,V2> m)
Creates a HashEnvironment with all the mappings in the given map.

Method Detail

clear

public void clear()
Clears all mappings.

containsKey

public boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key.

entrySet

public MapSet<K,V> entrySet()
The Set returned by this method is really a MapSet.

get

public V get(Object key)
Returns the value to which this map maps the specified key.

getMark

public Environment.Mark getMark()

main

public static void main(String[] argv)
Self-test function.

put

public V put(K key, V value)
Associates the specified value with the specified key in this map.

remove

public V remove(Object key)
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.

undoToMark

public void undoToMark(Environment.Mark m)
Copyright © 2003 C. Scott Ananian