harpoon.Util.DataStructs
Class LightMap

java.lang.Object
  |
  +--harpoon.Util.DataStructs.LightMap
All Implemented Interfaces:
Cloneable, Map, Serializable

public class LightMap
extends Object
implements Map, Cloneable, Serializable

LightMap is a very lightweight implementation of the java.util.Map interface.

Version:
$Id: LightMap.java,v 1.2 2002/02/25 21:09:19 cananian Exp $
Author:
Alexandru SALCIANU <salcianu@retezat.lcs.mit.edu>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
LightMap()
          Creates a LightMap.
LightMap(Map m)
          Creates a LightMap with the same mappings as the given map.
 
Method Summary
 void clear()
          Removes all mappings from this map.
 Object clone()
           
 boolean containsKey(Object key)
          Returns true if this map contains a mapping for the specified key.
 boolean containsValue(Object value)
          Unsupported yet.
 Set entrySet()
          Returns the set of entries of this map.
 boolean equals(Object o)
           
 Object get(Object key)
          Returns the value to which this map maps the specified key.
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
          Returns a set view of the keys contained in this map.
 Object put(Object key, Object value)
          Associates the specified value with the specified key in this map.
 void putAll(Map map)
          Copies all of the mappings from the specified map to this map.
 Object remove(Object key)
          Removes the mapping previously attached to key.
 int size()
           
 String toString()
           
 Collection values()
          Returns a collection view of the values contained in this map.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LightMap

public LightMap()
Creates a LightMap.


LightMap

public LightMap(Map m)
Creates a LightMap with the same mappings as the given map.

Method Detail

size

public final int size()
Specified by:
size in interface Map

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in interface Map

containsKey

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

Specified by:
containsKey in interface Map

containsValue

public final boolean containsValue(Object value)
Unsupported yet.

Specified by:
containsValue in interface Map

get

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

Specified by:
get in interface Map

put

public final Object put(Object key,
                        Object value)
Associates the specified value with the specified key in this map.

Specified by:
put in interface Map

remove

public final Object remove(Object key)
Removes the mapping previously attached to key. Returns the old mapping if any, or null otherwise.

Specified by:
remove in interface Map

putAll

public final void putAll(Map map)
                  throws UnsupportedOperationException
Copies all of the mappings from the specified map to this map.

Specified by:
putAll in interface Map
UnsupportedOperationException

clear

public final void clear()
                 throws UnsupportedOperationException
Removes all mappings from this map.

Specified by:
clear in interface Map
UnsupportedOperationException

values

public final Collection values()
Returns a collection view of the values contained in this map.

Specified by:
values in interface Map

entrySet

public final Set entrySet()
                   throws UnsupportedOperationException
Returns the set of entries of this map. The result is a Set of Map.Entry.

Specified by:
entrySet in interface Map
UnsupportedOperationException

keySet

public final Set keySet()
Returns a set view of the keys contained in this map. Unlike the java.util maps, this set is NOT backed by the map (eg removing a key from the returned set has no effect on the map).

Specified by:
keySet in interface Map

clone

public Object clone()
Overrides:
clone in class Object

equals

public boolean equals(Object o)
Specified by:
equals in interface Map
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object