Top Description Fields Constructors Methods
org.apache.commons.collections4.keyvalue

public Class TiedMapEntry<K, V>

extends Object
implements Map.Entry<K, V>, KeyValue<K, V>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.KeyValue, java.util.Map.Entry
Type Parameters
<K>
the type of keys
<V>
the type of mapped values
Imports
java.io.Serializable, java.util.Map, org.apache.commons.collections4.KeyValue

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
3.0

Field Summary

Modifier and TypeField and Description
private final K
key

The key

private final Map<K, V>
map

The map underlying the entry/iterator

private static final long
serialVersionUID

Serialization version

Constructor Summary

AccessConstructor and Description
public
TiedMapEntry(final Map<K, V>
the map
map
,
final K
the key
key
)

Constructs a new entry with the given Map and key.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if equal key and value
equals
(final Object
the object to compare to
obj
)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Compares this Map.Entry with another Map.Entry.
public K

Returns:

the key
getKey
()

Implements java.util.Map.Entry.getKey, org.apache.commons.collections4.KeyValue.getKey.

Gets the key of this entry
public V

Returns:

the value
getValue
()

Implements java.util.Map.Entry.getValue, org.apache.commons.collections4.KeyValue.getValue.

Gets the value of this entry direct from the map.
public int

Returns:

a suitable hash code
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Gets a hashCode compatible with the equals method.
public V

Returns:

the old value
setValue
(final V
the new value
value
)

Implements java.util.Map.Entry.setValue.

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

Returns:

entry as a string
toString
()

Overrides java.lang.Object.toString.

Gets a string version of the entry.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
private final K key

The key

mapback to summary
private final Map<K, V> map

The map underlying the entry/iterator

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization version

Constructor Detail

TiedMapEntryback to summary
public TiedMapEntry(final Map<K, V> map, final K key)

Constructs a new entry with the given Map and key.

Parameters
map:Map<K, V>

the map

key:K

the key

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Compares this Map.Entry with another Map.Entry.

Implemented per API documentation of java.util.Map.Entry#equals(Object)

Parameters
obj:Object

the object to compare to

Returns:boolean

true if equal key and value

Annotations
@Override
getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey, org.apache.commons.collections4.KeyValue.getKey.

Gets the key of this entry

Returns:K

the key

Annotations
@Override
getValueback to summary
public V getValue()

Implements java.util.Map.Entry.getValue, org.apache.commons.collections4.KeyValue.getValue.

Gets the value of this entry direct from the map.

Returns:V

the value

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Gets a hashCode compatible with the equals method.

Implemented per API documentation of java.util.Map.Entry#hashCode()

Returns:int

a suitable hash code

Annotations
@Override
setValueback to summary
public V setValue(final V value)

Implements java.util.Map.Entry.setValue.

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

Parameters
value:V

the new value

Returns:V

the old value

Annotations
@Override
Exceptions
IllegalArgumentException:
if the value is set to this map entry
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Gets a string version of the entry.

Returns:String

entry as a string

Annotations
@Override