Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.util
Class Hashtable.HashEntry  view Hashtable.HashEntry download Hashtable.HashEntry.java

java.lang.Object
  extended byjava.util.AbstractMap.BasicMapEntry
      extended byjava.util.Hashtable.HashEntry
All Implemented Interfaces:
Map.Entry
Enclosing class:
Hashtable

private static final class Hashtable.HashEntry
extends AbstractMap.BasicMapEntry

Class to represent an entry in the hash table. Holds a single key-value pair. A Hashtable Entry is identical to a HashMap Entry, except that `null' is not allowed for keys and values.


Field Summary
(package private)  java.lang.Object key
          The key.
(package private)  Hashtable.HashEntry next
          The next entry in the linked list.
(package private)  java.lang.Object value
          The value.
 
Constructor Summary
(package private) Hashtable.HashEntry(java.lang.Object key, java.lang.Object value)
          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)
          Resets the value.
 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

next

Hashtable.HashEntry next
The next entry in the linked list.


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

Hashtable.HashEntry

Hashtable.HashEntry(java.lang.Object key,
                    java.lang.Object value)
Simple constructor.

Method Detail

setValue

public java.lang.Object setValue(java.lang.Object newVal)
Resets the value.

Specified by:
setValue in interface Map.Entry
Overrides:
setValue in class AbstractMap.BasicMapEntry

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()))

Specified by:
equals in interface Map.Entry

getKey

public final java.lang.Object getKey()
Get the key corresponding to this entry.

Specified by:
getKey in interface Map.Entry

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.

Specified by:
getValue in interface Map.Entry

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())

Specified by:
hashCode in interface Map.Entry

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.