Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.collections.keyvalue
Class AbstractMapEntry

    java.lang.Object
      org.apache.commons.collections.keyvalue.AbstractKeyValue
          org.apache.commons.collections.keyvalue.AbstractMapEntry

All Implemented Interfaces:
  java.util.Map.Entry, KeyValue

Direct Known Subclasses:
  BeanMap.MyMapEntry, DefaultMapEntry, UnmodifiableMapEntry

    public abstract class AbstractMapEntry

extends AbstractKeyValue
implements java.util.Map.Entry

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

Since:
  Commons Collections 3.0
Version:
  $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
Author:
  James Strachan, Michael A. Smith, Neil O'Toole, Stephen Colebourne

Field Summary

Fields inherited from class org.apache.commons.collections.keyvalue.AbstractKeyValue
`key, value`

Constructor Summary
`protected` | `AbstractMapEntry(java.lang.Object key, java.lang.Object value)` Constructs a new entry with the given key and given value.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Compares this `Map.Entry` with another `Map.Entry`.
`int` | `hashCode()` Gets a hashCode compatible with the equals method.
`java.lang.Object` | `setValue(java.lang.Object value)` Sets the value stored in this `Map.Entry`.

Methods inherited from class org.apache.commons.collections.keyvalue.AbstractKeyValue
`getKey, getValue, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map.Entry
`getKey, getValue`

Constructor Detail

### AbstractMapEntry

    protected AbstractMapEntry(java.lang.Object key,
                               java.lang.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

### setValue

    public java.lang.Object setValue(java.lang.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.

  Specified by:
    `setValue` in interface `java.util.Map.Entry`
  Parameters:
    `value` - the new value
  Returns:
    the previous value

### equals

    public boolean equals(java.lang.Object obj)

  Compares this `Map.Entry` with another `Map.Entry`.

  Implemented per API documentation of `Map.Entry.equals(Object)`

  Specified by:
    `equals` in interface `java.util.Map.Entry`
  Overrides:
    `equals` in class `java.lang.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 `Map.Entry.hashCode()`

  Specified by:
    `hashCode` in interface `java.util.Map.Entry`
  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    a suitable hash code

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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