datastructures

net.datastructures
Interface Map

All Known Subinterfaces:
DecorablePosition, Edge, Vertex
All Known Implementing Classes:
AdjacencyListGraph.MyEdge, AdjacencyListGraph.MyPosition, AdjacencyListGraph.MyVertex, HashTable

public interface Map

An interface for a map which binds a key uniquely to a value.

Author:
Michael Goodrich

Method Summary
 Object get(Object key)
          Returns the value associated with a key.
 boolean isEmpty()
          Returns whether the map is empty.
 Iterator keys()
          Returns an iterator of all keys in the map.
 Object put(Object key, Object value)
          Put a key-value pair in the map, replacing previous one if it exists.
 Object remove(Object key)
          Removes the key-value pair with a specified key.
 int size()
          Returns the number of items in the map.
 Iterator values()
          Returns an iterator of all values in the map.
 

Method Detail

size

public int size()
Returns the number of items in the map.


isEmpty

public boolean isEmpty()
Returns whether the map is empty.


put

public Object put(Object key,
                  Object value)
           throws InvalidKeyException
Put a key-value pair in the map, replacing previous one if it exists.

Throws:
InvalidKeyException

get

public Object get(Object key)
           throws InvalidKeyException
Returns the value associated with a key.

Throws:
InvalidKeyException

remove

public Object remove(Object key)
              throws InvalidKeyException
Removes the key-value pair with a specified key.

Throws:
InvalidKeyException

keys

public Iterator keys()
Returns an iterator of all keys in the map.


values

public Iterator values()
Returns an iterator of all values in the map.


datastructures