org.cip4.jdflib.util
Class BiHashMap<a,b>

java.lang.Object
  extended by org.cip4.jdflib.util.BiHashMap<a,b>
Type Parameters:
a - any datatype for the key
b - any datatype for the value
All Implemented Interfaces:
Map<a,b>

public class BiHashMap<a,b>
extends Object
implements Map<a,b>

Bidirectional HashMap utility class

Author:
Rainer Prosi

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
BiHashMap()
           
 
Method Summary
 void clear()
          get the value for key
 boolean containsKey(Object arg0)
           
 boolean containsValue(Object arg0)
           
 Set<Map.Entry<a,b>> entrySet()
           
 b get(Object arg0)
           
 a getKey(b val)
          get the value for key
 Iterator<a> getKeyIterator()
           
 Map<a,b> getKeyMap()
          get a reference to the internal key map
 Map<b,a> getValMap()
          get a reference to the internal value map
 b getValue(a key)
          get the value for key
 boolean isEmpty()
           
 Set<a> keySet()
           
 b put(a key, b val)
          put the value for key
both key and value must be non-null
 void putAll(Map<? extends a,? extends b> arg0)
           
 b remove(Object key)
          remove key and its associated value
 a removeVal(Object value)
          remove value and its associated key
 int size()
           
 String toString()
           
 Collection<b> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

BiHashMap

public BiHashMap()
Method Detail

getValue

public b getValue(a key)
get the value for key

Parameters:
key - the key
Returns:
the corresponding value

getKeyIterator

public Iterator<a> getKeyIterator()
Returns:
the corresponding key iterator

getKey

public a getKey(b val)
get the value for key

Parameters:
val - the value
Returns:
the corresponding key

remove

public b remove(Object key)
remove key and its associated value

Specified by:
remove in interface Map<a,b>
Parameters:
key - the key
Returns:

removeVal

public a removeVal(Object value)
remove value and its associated key

Parameters:
value - the value
Returns:

put

public b put(a key,
             b val)
put the value for key
both key and value must be non-null

Specified by:
put in interface Map<a,b>
Parameters:
key - the key
val - the value
Returns:

clear

public void clear()
get the value for key

Specified by:
clear in interface Map<a,b>

getKeyMap

public Map<a,b> getKeyMap()
get a reference to the internal key map

Returns:

getValMap

public Map<b,a> getValMap()
get a reference to the internal value map

Returns:

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

containsKey

public boolean containsKey(Object arg0)
Specified by:
containsKey in interface Map<a,b>
Parameters:
arg0 -
Returns:
See Also:
Map.containsKey(java.lang.Object)

containsValue

public boolean containsValue(Object arg0)
Specified by:
containsValue in interface Map<a,b>
Parameters:
arg0 -
Returns:
See Also:
Map.containsValue(java.lang.Object)

entrySet

public Set<Map.Entry<a,b>> entrySet()
Specified by:
entrySet in interface Map<a,b>
Returns:
See Also:
Map.entrySet()

get

public b get(Object arg0)
Specified by:
get in interface Map<a,b>
Parameters:
arg0 -
Returns:
See Also:
Map.get(java.lang.Object)

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<a,b>
Returns:
See Also:
Map.isEmpty()

keySet

public Set<a> keySet()
Specified by:
keySet in interface Map<a,b>
Returns:
See Also:
Map.keySet()

putAll

public void putAll(Map<? extends a,? extends b> arg0)
Specified by:
putAll in interface Map<a,b>
Parameters:
arg0 -
See Also:
Map.putAll(java.util.Map)

size

public int size()
Specified by:
size in interface Map<a,b>
Returns:
See Also:
Map.size()

values

public Collection<b> values()
Specified by:
values in interface Map<a,b>
Returns:
See Also:
Map.values()


Copyright © 2013. All Rights Reserved.