Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.emf.ecp.common.spi
Class BidirectionalMap<K,V>

    java.lang.Object
      org.eclipse.emf.ecp.common.spi.BidirectionalMap<K,V>

Type Parameters:
  `K` - the type of the key
  `V` - the type of the value

    public class BidirectionalMap<K,V>

extends Object

Convenience class for mapping keys to values and vice versa. Both, keys and values, have to be unique.

Since:
  1.5
Author:
  emuller

Constructor Summary
`BidirectionalMap()` Default constructor.

Method Summary
`K` | `getByValue(V value)` Returns the key belonging to the given value.
`V` | `getValue(K key)` Returns the value belonging to the given key.
`Set<K>` | `keys()` Returns all keys.
`void` | `put(K key, V value)` Associates the specified value with the specified key in this map and vice versa.
`V` | `removeByKey(K key)` Removes the bidirectional mapping for the given key.
`K` | `removeByValue(V value)` Removes the bidirectional mapping for the given value.
`Set<V>` | `values()` Returns all values.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BidirectionalMap

    public BidirectionalMap()

  Default constructor.

Method Detail

### put

    public void put(K key,
                    V value)

  Associates the specified value with the specified key in this map and vice versa.

  Parameters:
    `key` - the key
    `value` - the value

### removeByKey

    public V removeByKey(K key)

  Removes the bidirectional mapping for the given key.

  Parameters:
    `key` - the key to be removed
  Returns:
    the value that was associated with the key

### removeByValue

    public K removeByValue(V value)

  Removes the bidirectional mapping for the given value.

  Parameters:
    `value` - the value to be removed
  Returns:
    the key that was associated with the value

### getValue

    public V getValue(K key)

  Returns the value belonging to the given key.

  Parameters:
    `key` - the key whose value should be looked up
  Returns:
    the value belonging to the given key

### getByValue

    public K getByValue(V value)

  Returns the key belonging to the given value.

  Parameters:
    `value` - the key whose value should be looked up
  Returns:
    the key belonging to the given value

### keys

    public Set<K> keys()

  Returns all keys.

  Returns:
    a set of all keys

### values

    public Set<V> values()

  Returns all values.

  Returns:
    a set of all values

Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2015. All Rights Reserved.