|
|||||||||
| Home >> All >> java >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.util
Class AbstractMap.BasicMapEntry

java.lang.Objectjava.util.AbstractMap.BasicMapEntry
- All Implemented Interfaces:
- Map.Entry
- Direct Known Subclasses:
- HashMap.HashEntry, Hashtable.HashEntry, TreeMap.Node
- Enclosing class:
- AbstractMap
- static class AbstractMap.BasicMapEntry
- extends java.lang.Object
- implements Map.Entry
- extends java.lang.Object
A class which implements Map.Entry. It is shared by HashMap, TreeMap, Hashtable, and Collections. It is not specified by the JDK, but makes life much easier.
| Field Summary | |
(package private) java.lang.Object |
key
The key. |
(package private) java.lang.Object |
value
The value. |
| Constructor Summary | |
(package private) |
AbstractMap.BasicMapEntry(java.lang.Object newKey,
java.lang.Object newValue)
Basic constructor initializes the fields. |
| Method Summary | |
boolean |
equals(java.lang.Object o)
Compares the specified object with this entry. |
java.lang.Object |
getKey()
Get the key corresponding to this entry. |
java.lang.Object |
getValue()
Get the value corresponding to this entry. |
int |
hashCode()
Returns the hash code of the entry. |
java.lang.Object |
setValue(java.lang.Object newVal)
Replaces the value with the specified object. |
java.lang.String |
toString()
This provides a string representation of the entry. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
key
java.lang.Object key
- The key. Package visible for direct manipulation.
value
java.lang.Object value
- The value. Package visible for direct manipulation.
| Constructor Detail |
AbstractMap.BasicMapEntry
AbstractMap.BasicMapEntry(java.lang.Object newKey, java.lang.Object newValue)
- Basic constructor initializes the fields.
| Method Detail |
equals
public final boolean equals(java.lang.Object o)
- Compares the specified object with this entry. Returns true only if
the object is a mapping of identical key and value. In other words,
this must be:
(o instanceof Map.Entry) && (getKey() == null ? ((HashMap) o).getKey() == null : getKey().equals(((HashMap) o).getKey())) && (getValue() == null ? ((HashMap) o).getValue() == null : getValue().equals(((HashMap) o).getValue()))
getKey
public final java.lang.Object getKey()
getValue
public final java.lang.Object getValue()
- Get the value corresponding to this entry. If you already called
Iterator.remove(), the behavior undefined, but in this case it works.
hashCode
public final int hashCode()
- Returns the hash code of the entry. This is defined as the exclusive-or
of the hashcodes of the key and value (using 0 for null). In other
words, this must be:
(getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode())
setValue
public java.lang.Object setValue(java.lang.Object newVal)
- Replaces the value with the specified object. This writes through
to the map, unless you have already called Iterator.remove(). It
may be overridden to restrict a null value.
toString
public final java.lang.String toString()
- This provides a string representation of the entry. It is of the form
"key=value", where string concatenation is used on key and value.
|
|||||||||
| Home >> All >> java >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.util.AbstractMap.BasicMapEntry