org.onemind.commons.java.datastructure
Class BiMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byorg.onemind.commons.java.datastructure.BiMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class BiMap
extends java.util.HashMap

A simple bi-directional map. It uses another map to store the inverse of this map. The key has to be unique in key space and the value need to be unique in the value space so that the value can be resolved to the key correctly. This class is not thread safe.

Version:
$Id: BiMap.java,v 1.1 2004/09/29 02:45:35 thlee Exp $ $Name: $
Author:
TiongHiang Lee (thlee@onemindsoft.org)
See Also:
Serialized Form

Constructor Summary
BiMap()
          Constructor
 
Method Summary
 void clear()
          
 BiMap getInverse()
          Get the inverse bimap
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          
 java.lang.Object remove(java.lang.Object key)
          
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, 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

BiMap

public BiMap()
Constructor

Method Detail

getInverse

public BiMap getInverse()
Get the inverse bimap

Returns:
the bimap

clear

public void clear()


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)


remove

public java.lang.Object remove(java.lang.Object key)



Copyright © 2004-2006 . All Rights Reserved.