urv.util.graph
Class HashMapSet<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,java.util.HashSet<V>>
          extended by urv.util.graph.HashMapSet<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.util.HashSet<V>>

public class HashMapSet<K,V>
extends java.util.HashMap<K,java.util.HashSet<V>>

This class offers methods to store elements in a list placed into a Hashmap

Author:
Marcel Arrufat Arias
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
HashMapSet()
           
 
Method Summary
 void addToSet(K key, V value)
          Adds a new value to the list of the specified key
 boolean existsInList(K key, V value)
          Checks whether the given value exists in the set of the given key
 java.util.HashSet<V> getSet(K key)
          Returns the whole set from a given key
 void putSet(K key, java.util.HashSet<V> value)
          Adds a new set to the specified key
 void removeFromBothSets(K key1, K key2)
          Removes key1 from set key2 and viceversa
 void removeFromSet(K key, V value)
          Removes a value from the set of the specified key
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

HashMapSet

public HashMapSet()
Method Detail

addToSet

public void addToSet(K key,
                     V value)
Adds a new value to the list of the specified key

Parameters:
key -
value -

existsInList

public boolean existsInList(K key,
                            V value)
Checks whether the given value exists in the set of the given key

Parameters:
key -
value -
Returns:

getSet

public java.util.HashSet<V> getSet(K key)
Returns the whole set from a given key

Parameters:
key -
Returns:

putSet

public void putSet(K key,
                   java.util.HashSet<V> value)
Adds a new set to the specified key

Parameters:
key -
value -

removeFromBothSets

public void removeFromBothSets(K key1,
                               K key2)
Removes key1 from set key2 and viceversa

Parameters:
key1 -
key2 -

removeFromSet

public void removeFromSet(K key,
                          V value)
Removes a value from the set of the specified key

Parameters:
key -
value -