net.datastructures
Interface Map<K,V>

All Known Subinterfaces:
DecorablePosition<E>, Edge<E>, Vertex<E>
All Known Implementing Classes:
HashTableMap

public interface Map<K,V>

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

Author:
Michael Goodrich

Method Summary
 java.lang.Iterable<Entry<K,V>> entries()
          Returns an iterable object containing all the entries in the map.
 V get(K key)
          Returns the value associated with a key.
 boolean isEmpty()
          Returns whether the map is empty.
 java.lang.Iterable<K> keys()
          Returns an iterable object containing all the keys in the map.
 V put(K key, V value)
          Puts a given key-value pair in the map, replacing a previous one, if any, and returns the old value.
 V remove(K key)
          Removes the key-value pair with a given key.
 int size()
          Returns the number of items in the map.
 java.lang.Iterable<V> values()
          Returns an iterable object containing all the values in the map.
 

Method Detail

size

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


isEmpty

boolean isEmpty()
Returns whether the map is empty.


put

V put(K key,
      V value)
      throws InvalidKeyException
Puts a given key-value pair in the map, replacing a previous one, if any, and returns the old value.

Throws:
InvalidKeyException

get

V get(K key)
      throws InvalidKeyException
Returns the value associated with a key.

Throws:
InvalidKeyException

remove

V remove(K key)
         throws InvalidKeyException
Removes the key-value pair with a given key.

Throws:
InvalidKeyException

keys

java.lang.Iterable<K> keys()
Returns an iterable object containing all the keys in the map.


values

java.lang.Iterable<V> values()
Returns an iterable object containing all the values in the map.


entries

java.lang.Iterable<Entry<K,V>> entries()
Returns an iterable object containing all the entries in the map.