类似于用两个HashMap进行实现
比如
get("Apple") -> 1
get("Pear")  -> 2
get(1)       -> "Apple"
get(2)       -> "Pear"Java中有没有类似的这种数据结构

解决方案 »

  1.   

    Google Guavacom.google.common.collect 
    Interface BiMap<K,V>All Superinterfaces:
    Map<K,V>
    All Known Implementing Classes:
    EnumBiMap, EnumHashBiMap, HashBiMap, ImmutableBiMap
    @GwtCompatible
    public interface BiMap<K,V>
    extends Map<K,V>
    A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as that of its keys. This constraint enables bimaps to support an "inverse view", which is another bimap containing the same entries as this bimap but with reversed keys and values.
      

  2.   

    我的意思是Java有没有原生支持  没有就算了 自己实现
    LS好东西啊~~