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

java.lang.Objectjava.util.AbstractMap.BasicMapEntry
java.util.TreeMap.Node
- All Implemented Interfaces:
- Map.Entry
- Enclosing class:
- TreeMap
- private static final class TreeMap.Node
- extends AbstractMap.BasicMapEntry
Class to represent an entry in the tree. Holds a single key-value pair, plus pointers to parent and child nodes.
| Field Summary | |
(package private) int |
color
The color of this node. |
(package private) java.lang.Object |
key
The key. |
(package private) TreeMap.Node |
left
The left child node. |
(package private) TreeMap.Node |
parent
The parent node. |
(package private) TreeMap.Node |
right
The right child node. |
(package private) java.lang.Object |
value
The value. |
| Constructor Summary | |
(package private) |
TreeMap.Node(java.lang.Object key,
java.lang.Object value,
int color)
Simple constructor. |
| 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 |
color
int color
- The color of this node.
left
TreeMap.Node left
- The left child node.
right
TreeMap.Node right
- The right child node.
parent
TreeMap.Node parent
- The parent node.
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 |
TreeMap.Node
TreeMap.Node(java.lang.Object key, java.lang.Object value, int color)
- Simple constructor.
| 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