BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Class AbstractMap

java.lang.Object
  |
  +--brutil.AbstractMap
All Implemented Interfaces:
Collection, Map
Direct Known Subclasses:
ArrayMap, HashMap, LinkedMap, RBMap

public abstract class AbstractMap
extends java.lang.Object
implements Map


Field Summary
protected  Set set
           
 
Constructor Summary
AbstractMap()
           
 
Method Summary
 void clear()
          Clears out the contents of the Collection (optional operation)
 boolean containsKey(java.lang.Object key)
          Checks to see if the specified key object is in the Map.
 java.lang.Object get(java.lang.Object key)
          Returns the value to which the specified key is mapped in this Map.
 boolean isEmpty()
          Returns true if the Collection contains no elements, false otherwise
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value in this Map.
 java.lang.Object remove(java.lang.Object key)
          Removes the key (and its corresponding value) from this Map.
protected abstract  Set setFactory()
          This method is abstract, to be replaced by subclasses to provide the correct implementation.
 int size()
          Returns the size of the given Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

set

protected Set set
Constructor Detail

AbstractMap

public AbstractMap()
Method Detail

setFactory

protected abstract Set setFactory()
This method is abstract, to be replaced by subclasses to provide the correct implementation.

get

public java.lang.Object get(java.lang.Object key)
Returns the value to which the specified key is mapped in this Map.
Specified by:
get in interface Map
Parameters:
key - a key in the Map.
Returns:
the value to which the key is mapped in this Map; null if the key is not mapped to any value in this Map.
See Also:
put(Object, Object)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Maps the specified key to the specified value in this Map. The key cannot be null.
Specified by:
put in interface Map
Parameters:
key - the Map key.
data - the value.
Returns:
the previous value of the specified key in this Map, or null if it did not have one.
Throws:
NullPointerException - if key is null.
See Also:
get(Object)

remove

public java.lang.Object remove(java.lang.Object key)
Removes the key (and its corresponding value) from this Map. This method does nothing if the key is not in the Map.
Specified by:
remove in interface Map
Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this Map, or null if the key did not have a mapping.

containsKey

public boolean containsKey(java.lang.Object key)
Checks to see if the specified key object is in the Map.
Specified by:
containsKey in interface Map
Parameters:
key - the key to be found.
Returns:
true if the key is in the map.

size

public int size()
Returns the size of the given Collection.
Specified by:
size in interface Collection

isEmpty

public boolean isEmpty()
Returns true if the Collection contains no elements, false otherwise
Specified by:
isEmpty in interface Collection

clear

public void clear()
Clears out the contents of the Collection (optional operation)
Specified by:
clear in interface Collection


BRUtil - Making Java a Kinder, Gentler, Place to be.