org.apache.commons.collections.keyvalue

Class AbstractMapEntry

public abstract class AbstractMapEntry extends AbstractKeyValue implements Entry

Abstract Pair class to assist with creating correct java.util.Map.Entry Map.Entry implementations.

Since: Commons Collections 3.0

Version: $Revision: 405927 $ $Date: 2006-05-12 23:57:03 +0100 (Fri, 12 May 2006) $

Author: James Strachan Michael A. Smith Neil O'Toole Stephen Colebourne

Constructor Summary
protected AbstractMapEntry(Object key, Object value)
Constructs a new entry with the given key and given value.
Method Summary
booleanequals(Object obj)
Compares this Map.Entry with another Map.Entry.
inthashCode()
Gets a hashCode compatible with the equals method.
ObjectsetValue(Object value)
Sets the value stored in this Map.Entry.

Constructor Detail

AbstractMapEntry

protected AbstractMapEntry(Object key, Object value)
Constructs a new entry with the given key and given value.

Parameters: key the key for the entry, may be null value the value for the entry, may be null

Method Detail

equals

public boolean equals(Object obj)
Compares this Map.Entry with another Map.Entry.

Implemented per API documentation of java.util.Map.Entry#equals(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 java.util.Map.Entry#hashCode()

Returns: a suitable hash code

setValue

public Object setValue(Object value)
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 the new value

Returns: the previous value

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