## org.apache.commons.collections.keyvalue
Class TiedMapEntry

    java.lang.Object
      org.apache.commons.collections.keyvalue.TiedMapEntry

All Implemented Interfaces:
  java.io.Serializable, java.util.Map.Entry, KeyValue

    public class TiedMapEntry

extends java.lang.Object
implements java.util.Map.Entry, KeyValue, java.io.Serializable

A `Map.Entry` tied to a map underneath.

This can be used to enable a map entry to make changes on the underlying map, however this will probably mess up any iterators.

Since:
  Commons Collections 3.0
Version:
  $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
Author:
  Stephen Colebourne
See Also:
  Serialized Form

Constructor Summary
`TiedMapEntry(java.util.Map map, java.lang.Object key)` Constructs a new entry with the given Map and key.

Method Summary
`boolean` `equals(java.lang.Object obj)` Compares this `Map.Entry` with another `Map.Entry`.
`java.lang.Object` `getKey()` Gets the key of this entry
`java.lang.Object` `getValue()` Gets the value of this entry direct from the map.
`int` `hashCode()` Gets a hashCode compatible with the equals method.
`java.lang.Object` `setValue(java.lang.Object value)` Sets the value associated with the key direct onto the map.
`java.lang.String` `toString()` Gets a string version of the entry.

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

Constructor Detail

### TiedMapEntry

    public TiedMapEntry(java.util.Map map,
                        java.lang.Object key)

  Constructs a new entry with the given Map and key.

  Parameters:
    `map` - the map
    `key` - the key

Method Detail

### getKey

    public java.lang.Object getKey()

  Gets the key of this entry

  Specified by:
    `getKey` in interface `java.util.Map.Entry`
  Specified by:
    `getKey` in interface `KeyValue`
  Returns:
    the key

### getValue

    public java.lang.Object getValue()

  Gets the value of this entry direct from the map.

  Specified by:
    `getValue` in interface `java.util.Map.Entry`
  Specified by:
    `getValue` in interface `KeyValue`
  Returns:
    the value

### setValue

    public java.lang.Object setValue(java.lang.Object value)

  Sets the value associated with the key direct onto the map.

  Specified by:
    `setValue` in interface `java.util.Map.Entry`
  Parameters:
    `value` - the new value
  Returns:
    the old value
  Throws:
    `java.lang.IllegalArgumentException` - if the value is set to this map entry

### equals

    public boolean equals(java.lang.Object obj)

  Compares this `Map.Entry` with another `Map.Entry`.

  Implemented per API documentation of `Map.Entry.equals(Object)`

  Specified by:
    `equals` in interface `java.util.Map.Entry`
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object to compare to
  Returns:
    true if equal key and value

### hashCode

    public int hashCode()

  Gets a hashCode compatible with the equals method.

  Implemented per API documentation of `Map.Entry.hashCode()`

  Specified by:
    `hashCode` in interface `java.util.Map.Entry`
  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    a suitable hash code

### toString

    public java.lang.String toString()

  Gets a string version of the entry.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    entry as a string

Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.