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

## org.fourthline.cling.support.shared
Class AbstractMap<K,V>

    java.lang.Object
      org.fourthline.cling.support.shared.AbstractMap<K,V>

All Implemented Interfaces:
  Map<K,V>

    public abstract class AbstractMap<K,V>

extends Object
implements Map<K,V>

A base class for `Map` implementations.

Subclasses that permit new mappings to be added must override `put(K, V)`.

The default implementations of many methods are inefficient for large maps. For example in the default implementation, each call to `get(java.lang.Object)` performs a linear iteration of the entry set. Subclasses should override such methods to improve their performance.

Since:
  1.2

Nested Class Summary
`static class` | `AbstractMap.SimpleEntry<K,V>` A key-value mapping with mutable values.
`static class` | `AbstractMap.SimpleImmutableEntry<K,V>` An immutable key-value mapping.

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

Constructor Summary
`protected` | `AbstractMap()`

Method Summary
`void` | `clear()`
`protected Object` | `clone()`
`boolean` | `containsKey(Object key)`
`boolean` | `containsValue(Object value)`
`abstract Set<Map.Entry<K,V>>` | `entrySet()`
`boolean` | `equals(Object object)`
`V` | `get(Object key)`
`int` | `hashCode()`
`boolean` | `isEmpty()`
`Set<K>` | `keySet()`
`V` | `put(K key, V value)`
`void` | `putAll(Map<? extends K,? extends V> map)`
`V` | `remove(Object key)`
`int` | `size()`
`String` | `toString()`
`Collection<V>` | `values()`

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

Constructor Detail

### AbstractMap

    protected AbstractMap()

Method Detail

### clear

    public void clear()

  This implementation calls `entrySet().clear()`.

  Specified by:
    `clear` in interface `Map<K,V>`

### containsKey

    public boolean containsKey(Object key)

  This implementation iterates its key set, looking for a key that `key` equals.

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

### containsValue

    public boolean containsValue(Object value)

  This implementation iterates its entry set, looking for an entry with a value that `value` equals.

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

### entrySet

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

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

### equals

    public boolean equals(Object object)

  This implementation first checks the structure of `object`. If it is not a map or of a different size, this returns false. Otherwise it iterates its own entry set, looking up each entry's key in `object`. If any value does not equal the other map's value for the same key, this returns false. Otherwise it returns true.

  Specified by:
    `equals` in interface `Map<K,V>`
  Overrides:
    `equals` in class `Object`

### get

    public V get(Object key)

  This implementation iterates its entry set, looking for an entry with a key that `key` equals.

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

### hashCode

    public int hashCode()

  This implementation iterates its entry set, summing the hashcodes of its entries.

  Specified by:
    `hashCode` in interface `Map<K,V>`
  Overrides:
    `hashCode` in class `Object`

### isEmpty

    public boolean isEmpty()

  This implementation compares `size()` to 0.

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

### keySet

    public Set<K> keySet()

  This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return keys.

  Specified by:
    `keySet` in interface `Map<K,V>`

### put

    public V put(K key,
                 V value)

  This base implementation throws `UnsupportedOperationException`.

  Specified by:
    `put` in interface `Map<K,V>`

### putAll

    public void putAll(Map<? extends K,? extends V> map)

  This implementation iterates through `map`'s entry set, calling `put()` for each.

  Specified by:
    `putAll` in interface `Map<K,V>`

### remove

    public V remove(Object key)

  This implementation iterates its entry set, removing the entry with a key that `key` equals.

  Specified by:
    `remove` in interface `Map<K,V>`

### size

    public int size()

  This implementation returns its entry set's size.

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

### toString

    public String toString()

  This implementation composes a string by iterating its entry set. If this map contains itself as a key or a value, the string "(this Map)" will appear in its place.

  Overrides:
    `toString` in class `Object`

### values

    public Collection<V> values()

  This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return values.

  Specified by:
    `values` in interface `Map<K,V>`

### clone

    protected Object clone()
                    throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

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

Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.