Class TiedMapEntry<K,V>
- java.lang.Object
-
- org.apache.commons.collections4.keyvalue.TiedMapEntry<K,V>
-
- Type Parameters:
K
- the type of keysV
- the type of mapped values
- All Implemented Interfaces:
java.io.Serializable
,java.util.Map.Entry<K,V>
,KeyValue<K,V>
public class TiedMapEntry<K,V> extends java.lang.Object implements java.util.Map.Entry<K,V>, KeyValue<K,V>, java.io.Serializable
AMap.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:
- 3.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TiedMapEntry(java.util.Map<K,V> map, K key)
Constructs a new entry with the given Map and key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Compares thisMap.Entry
with anotherMap.Entry
.K
getKey()
Gets the key of this entryV
getValue()
Gets the value of this entry direct from the map.int
hashCode()
Gets a hashCode compatible with the equals method.V
setValue(V value)
Sets the value associated with the key direct onto the map.java.lang.String
toString()
Gets a string version of the entry.
-
-
-
Method Detail
-
getKey
public K getKey()
Gets the key of this entry
-
getValue
public V getValue()
Gets the value of this entry direct from the map.
-
equals
public boolean equals(java.lang.Object obj)
Compares thisMap.Entry
with anotherMap.Entry
.Implemented per API documentation of
Map.Entry.equals(Object)
-
hashCode
public int hashCode()
Gets a hashCode compatible with the equals method.Implemented per API documentation of
Map.Entry.hashCode()
-
toString
public java.lang.String toString()
Gets a string version of the entry.- Overrides:
toString
in classjava.lang.Object
- Returns:
- entry as a string
-
-