Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.collections
Class MergedMap<K,V>

    java.lang.Object
      java.util.AbstractMap<K,V>
          umontreal.iro.lecuyer.collections.MergedMap<K,V>

Type Parameters:
  `K` - the type of the keys in the merged map.
  `V` - the type of the values in the merged map.

All Implemented Interfaces:
  Map<K,V>

    public class MergedMap<K,V>

extends AbstractMap<K,V>

Represents a map merging two maps. A merged map is constructed from two maps `map1` and `map2`, contains the keys of both maps, and is immutable. However, any change to the inner maps is reflected on the merged map. Note that if both maps contain the same key, the key appears only once in the merged map, and the corresponding value comes from the entry in the first map. The iterators returned by this implementation enumerates the elements of the first map, then the elements of the second map.

Nested Class Summary

Nested classes/interfaces inherited from class java.util.AbstractMap
`AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

Nested classes/interfaces inherited from interface java.util.Map
`Map.Entry<K,V>`

Constructor Summary
`MergedMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2)` Constructs a new merged map from maps `map1` and `map2`.

Method Summary
`boolean` | `containsKey(Object key)`
`boolean` | `containsValue(Object value)`
`Set<Map.Entry<K,V>>` | `entrySet()`
`V` | `get(Object key)`
`Map<? extends K,? extends V>` | `getFirstMap()` Returns a reference to the first map in this merged map.
`Map<? extends K,? extends V>` | `getSecondMap()` Returns a reference to the second map in this merged map.
`boolean` | `isEmpty()`
`int` | `size()`

Methods inherited from class java.util.AbstractMap
`clear, clone, equals, hashCode, keySet, put, putAll, remove, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MergedMap

    public MergedMap(Map<? extends K,? extends V> map1,
                     Map<? extends K,? extends V> map2)

  Constructs a new merged map from maps `map1` and `map2`.

  Parameters:
    `map1` - the first map.
    `map2` - the second map.
  Throws:
    `NullPointerException` - if `map1` or `map2` are `null`.

Method Detail

### getFirstMap

    public Map<? extends K,? extends V> getFirstMap()

  Returns a reference to the first map in this merged map.

  Returns:
    the first map.

### getSecondMap

    public Map<? extends K,? extends V> getSecondMap()

  Returns a reference to the second map in this merged map.

  Returns:
    the second map.

### entrySet

    public Set<Map.Entry<K,V>> entrySet()

  Specified by:
    `entrySet` in interface `Map<K,V>`
  Specified by:
    `entrySet` in class `AbstractMap<K,V>`

### containsKey

    public boolean containsKey(Object key)

  Specified by:
    `containsKey` in interface `Map<K,V>`
  Overrides:
    `containsKey` in class `AbstractMap<K,V>`

### containsValue

    public boolean containsValue(Object value)

  Specified by:
    `containsValue` in interface `Map<K,V>`
  Overrides:
    `containsValue` in class `AbstractMap<K,V>`

### get

    public V get(Object key)

  Specified by:
    `get` in interface `Map<K,V>`
  Overrides:
    `get` in class `AbstractMap<K,V>`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Map<K,V>`
  Overrides:
    `isEmpty` in class `AbstractMap<K,V>`

### size

    public int size()

  Specified by:
    `size` in interface `Map<K,V>`
  Overrides:
    `size` in class `AbstractMap<K,V>`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.