## org.apache.commons.collections
Class DefaultMapEntry

    java.lang.Object
      org.apache.commons.collections.DefaultMapEntry

All Implemented Interfaces:
  KeyValue, Map.Entry

Deprecated. Use the version in the keyvalue subpackage. Will be removed in v4.0

public class DefaultMapEntry
extends Object
implements Map.Entry, KeyValue

A default implementation of `Map.Entry`

Since:
  Commons Collections 1.0
Version:
  $Revision: 1.21 $ $Date: 2004/02/18 01:15:42 $
Author:
  James Strachan, Michael A. Smith, Neil O'Toole, Stephen Colebourne

Constructor Summary
`DefaultMapEntry()` Deprecated. Constructs a new `DefaultMapEntry` with a null key and null value.
`DefaultMapEntry(Map.Entry entry)` Deprecated. Constructs a new `DefaultMapEntry` with the given key and given value.
`DefaultMapEntry(Object key, Object value)` Deprecated. Constructs a new `DefaultMapEntry` with the given key and given value.

Method Summary
`boolean` `equals(Object obj)` Deprecated. Compares this Map Entry with another Map Entry.
`Object` `getKey()` Deprecated. Gets the key from the Map Entry.
`Object` `getValue()` Deprecated. Gets the value from the Map Entry.
`int` `hashCode()` Deprecated. Gets a hashCode compatible with the equals method.
`void` `setKey(Object key)` Deprecated. Sets the key stored in this Map Entry.
`Object` `setValue(Object value)` Deprecated. Sets the value stored in this Map Entry.
`String` `toString()` Deprecated. Written to match the output of the Map.Entry's used in a `HashMap`.

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

Constructor Detail

### DefaultMapEntry

    public DefaultMapEntry()

  Deprecated.
  Constructs a new `DefaultMapEntry` with a null key and null value.

### DefaultMapEntry

    public DefaultMapEntry(Map.Entry entry)

  Deprecated.
  Constructs a new `DefaultMapEntry` with the given key and given value.

Parameters:
  `entry` - the entry to copy, must not be null
Throws:
  `NullPointerException` - if the entry is null

### DefaultMapEntry

    public DefaultMapEntry(Object key,
                           Object value)

  Deprecated.
  Constructs a new `DefaultMapEntry` 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

### getKey

    public Object getKey()

  Deprecated.
  Gets the key from the Map Entry.

  Specified by:
    `getKey` in interface `Map.Entry`
  Returns:
    the key

### setKey

    public void setKey(Object key)

  Deprecated.
  Sets the key stored in this Map Entry.

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

  Parameters:
    `key` - the new key

### getValue

    public Object getValue()

  Deprecated.
  Gets the value from the Map Entry.

  Specified by:
    `getValue` in interface `Map.Entry`
  Returns:
    the value

### setValue

    public Object setValue(Object value)

  Deprecated.
  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 `Map.Entry`
  Parameters:
    `value` - the new value
  Returns:
    the previous value

### equals

    public boolean equals(Object obj)

  Deprecated.
  Compares this Map Entry with another Map Entry.

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

  Specified by:
    `equals` in interface `Map.Entry`
  Parameters:
    `obj` - the object to compare to
  Returns:
    true if equal key and value

### hashCode

    public int hashCode()

  Deprecated.
  Gets a hashCode compatible with the equals method.

  Implemented per API documentation of `Map.Entry.hashCode()`

  Specified by:
    `hashCode` in interface `Map.Entry`
  Returns:
    a suitable hash code

### toString

    public String toString()

  Deprecated.
  Written to match the output of the Map.Entry's used in a `HashMap`.

  Since:
    3.0

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