public class

TiedMapEntry

extends Object
implements Serializable Map.Entry<K, V> KeyValue
java.lang.Object
   ↳ org.apache.commons.collections.keyvalue.TiedMapEntry

Class Overview

A java.util.Map.Entry 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.

Summary

Public Constructors
TiedMapEntry(Map map, Object key)
Constructs a new entry with the given Map and key.
Public Methods
boolean equals(Object obj)
Compares this Map.Entry with another Map.Entry.
Object getKey()
Gets the key of this entry
Object getValue()
Gets the value of this entry direct from the map.
int hashCode()
Gets a hashCode compatible with the equals method.
Object setValue(Object value)
Sets the value associated with the key direct onto the map.
String toString()
Gets a string version of the entry.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Map.Entry
From interface org.apache.commons.collections.KeyValue

Public Constructors

public TiedMapEntry (Map map, Object key)

Constructs a new entry with the given Map and key.

Parameters
map the map
key the key

Public Methods

public boolean equals (Object obj)

Compares this Map.Entry with another Map.Entry.

Implemented per API documentation of equals(Object)

Parameters
obj the object to compare to
Returns
  • true if equal key and value

public Object getKey ()

Gets the key of this entry

Returns
  • the key

public Object getValue ()

Gets the value of this entry direct from the map.

Returns
  • the value

public int hashCode ()

Gets a hashCode compatible with the equals method.

Implemented per API documentation of hashCode()

Returns
  • a suitable hash code

public Object setValue (Object value)

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

Parameters
value the new value
Returns
  • the old value
Throws
IllegalArgumentException if the value is set to this map entry

public String toString ()

Gets a string version of the entry.

Returns
  • entry as a string