# Class: com.pnfsoftware.jeb.util.collect.BiMap

A bidirectional map of key\-values. This class is [serializable](Ser). The null key and null value are forbidden. The key\-value mapping is one\-to\-one: a key can only map to one value, and one value can only map to one key. \(One consequence is that [putting](#put(Object, Object)) a key\-value pair may either increment, keep the same, or even decrement the map size. 

 Thread\-safety: none. 

 Note: this class does not implement the [Map](Map) interface, but attempts to follow its guidelines and contracts the best it can. One notable exception is that this class does not override hashCode/equals.

## Constructor: BiMap

Description: Create a new bi\-map.

## Constructor: BiMap
- parameter: `o`, type: `com.pnfsoftware.jeb.util.collect.BiMap<K,V>`

Description: Create a copy of an existing bi\-map.
parameter: o: source bi\-map

## Constructor: BiMap
- parameter: `keyOrder`, type: `com.pnfsoftware.jeb.util.collect.CollectionOrder`

Description: Create a new bi\-map.
parameter: keyOrder: key ordering

## Method: asMap
- return type: `java.util.Map<K,V>`

Description: Get a read\-only view of the forward map.
return: read\-only forward map

## Method: asReverseMap
- return type: `java.util.Map<V,K>`

Description: Get a read\-only view of the reverse map.
return: read\-only reverse map

## Method: clear

Description: Remove all mappings.

## Method: containsKey
- parameter: `key`, type: `K`
- return type: `boolean`

Description: Determine whether a key is present.
parameter: key: key
return: true if the key is present

## Method: containsValue
- parameter: `value`, type: `V`
- return type: `boolean`

Description: Determine whether a value is present.
parameter: value: value
return: true if the value is present

## Method: get
- parameter: `key`, type: `K`
- return type: `V`

Description: Retrieve a value by key.
parameter: key: key
return: value associated with the key, or null

## Method: getKeyForValue
- parameter: `value`, type: `V`
- return type: `K`

Description: Retrieve a key by value.
parameter: value: value
return: key associated with the value, or null

## Method: isEmpty
- return type: `boolean`

Description: Determine whether this map is empty.
return: true if no mapping exists

## Method: keySet
- return type: `java.util.Set<K>`

Description: Get a view of the keys.
return: key set view

## Method: put
- parameter: `key`, type: `K`
- parameter: `value`, type: `V`
- return type: `V`

Description: Add a one\-to\-one key\-value mapping.
parameter: key: non\-null key
parameter: value: non\-null value
return: value previously associated with the key, or null

## Method: putAll
- parameter: `m`, type: `java.util.Map<? extends K,? extends V>`

Description: Add all mappings from a map.
parameter: m: source map

## Method: remove
- parameter: `key`, type: `K`
- return type: `V`

Description: Remove a mapping by key.
parameter: key: key
return: removed value, or null

## Method: removeValue
- parameter: `value`, type: `V`
- return type: `K`

Description: Remove a mapping by value.
parameter: value: value
return: removed key, or null

## Method: size
- return type: `int`

Description: Get the number of mappings.
return: number of mappings

## Method: toString
- return type: `java.lang.String`


## Method: values
- return type: `java.util.Set<V>`

Description: Get a view of the values.
return: value set view

