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

## edu.emory.mathcs.backport.java.util
Class AbstractMap.SimpleEntry

    java.lang.Object
      edu.emory.mathcs.backport.java.util.AbstractMap.SimpleEntry

All Implemented Interfaces:
  java.util.Map.Entry

Enclosing class:
  AbstractMap

public static class AbstractMap.SimpleEntry
extends java.lang.Object
implements java.util.Map.Entry

An Entry maintaining a key and a value. The value may be changed using the `setValue` method. This class facilitates the process of building custom map implementations. For example, it may be convenient to return arrays of `SimpleEntry` instances in method `Map.entrySet().toArray`

Since:
  1.6

Constructor Summary
`AbstractMap.SimpleEntry(java.util.Map.Entry entry)` Creates an entry representing the same mapping as the specified entry.
`AbstractMap.SimpleEntry(java.lang.Object key, java.lang.Object value)` Creates an entry representing a mapping from the specified key to the specified value.

Method Summary
`boolean` | `equals(java.lang.Object o)`
`java.lang.Object` | `getKey()` Returns the key corresponding to this entry.
`java.lang.Object` | `getValue()` Returns the value corresponding to this entry.
`int` | `hashCode()`
`java.lang.Object` | `setValue(java.lang.Object value)` Replaces the value corresponding to this entry with the specified value.
`java.lang.String` | `toString()` Returns a String representation of this map entry.

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

Constructor Detail

### AbstractMap.SimpleEntry

    public AbstractMap.SimpleEntry(java.lang.Object key,
                                   java.lang.Object value)

  Creates an entry representing a mapping from the specified key to the specified value.

Parameters:
  `key` - the key represented by this entry
  `value` - the value represented by this entry

### AbstractMap.SimpleEntry

    public AbstractMap.SimpleEntry(java.util.Map.Entry entry)

  Creates an entry representing the same mapping as the specified entry.

Parameters:
  `entry` - the entry to copy

Method Detail

### getKey

    public java.lang.Object getKey()

  Returns the key corresponding to this entry.

  Specified by:
    `getKey` in interface `java.util.Map.Entry`
  Returns:
    the key corresponding to this entry

### getValue

    public java.lang.Object getValue()

  Returns the value corresponding to this entry.

  Specified by:
    `getValue` in interface `java.util.Map.Entry`
  Returns:
    the value corresponding to this entry

### setValue

    public java.lang.Object setValue(java.lang.Object value)

  Replaces the value corresponding to this entry with the specified value.

  Specified by:
    `setValue` in interface `java.util.Map.Entry`
  Parameters:
    `value` - new value to be stored in this entry
  Returns:
    the old value corresponding to the entry

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Map.Entry`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `java.util.Map.Entry`

### toString

    public java.lang.String toString()

  Returns a String representation of this map entry. This implementation returns the string representation of this entry's key followed by the equals character ("`=`") followed by the string representation of this entry's value.

  Returns:
    a String representation of this map entry

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