## org.apache.commons.collections
Class DefaultMapEntry

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

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

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

    public class DefaultMapEntry

extends java.lang.Object
implements java.util.Map.Entry, KeyValue

A default implementation of `Map.Entry`

Since:
  Commons Collections 1.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

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

Method Summary
`boolean` `equals(java.lang.Object obj)` Deprecated. Compares this Map Entry with another Map Entry.
`java.lang.Object` `getKey()` Deprecated. Gets the key from the Map Entry.
`java.lang.Object` `getValue()` Deprecated. Gets the value from the Map Entry.
`int` `hashCode()` Deprecated. Gets a hashCode compatible with the equals method.
`void` `setKey(java.lang.Object key)` Deprecated. Sets the key stored in this Map Entry.
`java.lang.Object` `setValue(java.lang.Object value)` Deprecated. Sets the value stored in this Map Entry.
`java.lang.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(java.util.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:
    `java.lang.NullPointerException` - if the entry is null

### DefaultMapEntry

    public DefaultMapEntry(java.lang.Object key,
                           java.lang.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 java.lang.Object getKey()

  Deprecated.
  Gets the key from the Map Entry.

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

### setKey

    public void setKey(java.lang.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 java.lang.Object getValue()

  Deprecated.
  Gets the value from the Map Entry.

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

### setValue

    public java.lang.Object setValue(java.lang.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 `java.util.Map.Entry`
  Parameters:
    `value` - the new value
  Returns:
    the previous value

### equals

    public boolean equals(java.lang.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 `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()

  Deprecated.
  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

### toString

    public java.lang.String toString()

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

  Overrides:
    `toString` in class `java.lang.Object`
  Since:
    3.0

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