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

public abstract Class AbstractMapEntry<K, V>

extends AbstractKeyValue<K, V>
implements Map.Entry<K, V>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry
Known Direct Subclasses
org.apache.commons.collections4.keyvalue.DefaultMapEntry, org.apache.commons.collections4.keyvalue.UnmodifiableMapEntry, org.apache.commons.collections4.map.ListOrderedMap.ListOrderedMapEntry, org.apache.commons.collections4.multimap.AbstractMultiValuedMap.MultiValuedMapEntry
Type Parameters
<K>
the type of keys
<V>
the type of mapped values
Imports
java.util.Map

Abstract Pair class to assist with creating correct Map.Entry implementations.
Since
3.0

Constructor Summary

AccessConstructor and Description
protected
AbstractMapEntry(final K
the key for the entry, may be null
key
,
final V
the value for the entry, may be null
value
)

Constructs a new entry with the given key and given value.

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 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 previous value
setValue
(final V
the new value
value
)

Overrides org.apache.commons.collections4.keyvalue.AbstractKeyValue.setValue.

Implements java.util.Map.Entry.setValue.

Sets the value stored in this Map.Entry.
Inherited from org.apache.commons.collections4.keyvalue.AbstractKeyValue:
getKeygetValuesetKeytoString

Constructor Detail

AbstractMapEntryback to summary
protected AbstractMapEntry(final K key, final V value)

Constructs a new entry with the given key and given value.

Parameters
key:K

the key for the entry, may be null

value:V

the value for the entry, may be null

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
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)

Overrides org.apache.commons.collections4.keyvalue.AbstractKeyValue.setValue.

Implements java.util.Map.Entry.setValue.

Sets the value stored in this Map.Entry.

This Map.Entry is not connected to a Map, so only the local data is changed.

Parameters
value:V

the new value

Returns:V

the previous value

Annotations
@Override