com.sleepycat.bdb.collection
Class MapEntry

java.lang.Object
  extended by com.sleepycat.bdb.collection.MapEntry
All Implemented Interfaces:
java.util.Map.Entry

public class MapEntry
extends java.lang.Object
implements java.util.Map.Entry

A simple Map.Entry implementation.

Warning: Use of this interface violates the Java Collections interface contract since these state that Map.Entry objects should only be obtained from Map.entrySet() sets, while this class allows constructing them directly. However, it is useful for performing operations on an entry set such as add(), contains(), etc. For restrictions see getValue() and setValue(java.lang.Object).


Constructor Summary
MapEntry(java.lang.Object key, java.lang.Object value)
          Creates a map entry with a given key and value.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares this entry to a given entry as specified by Map.Entry.equals(java.lang.Object).
 java.lang.Object getKey()
          Returns the key of this entry.
 java.lang.Object getValue()
          Returns the value of this entry.
 int hashCode()
          Computes a hash code as specified by Map.Entry.hashCode().
 java.lang.Object setValue(java.lang.Object newValue)
          Changes the value of this entry.
 java.lang.String toString()
          Converts the entry to a string representation for debugging.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapEntry

public MapEntry(java.lang.Object key,
                java.lang.Object value)
Creates a map entry with a given key and value.

Parameters:
key - is the key to use.
value - is the value to use.
Method Detail

hashCode

public int hashCode()
Computes a hash code as specified by Map.Entry.hashCode().

Specified by:
hashCode in interface java.util.Map.Entry
Overrides:
hashCode in class java.lang.Object
Returns:
the computed hash code.

equals

public boolean equals(java.lang.Object other)
Compares this entry to a given entry as specified by Map.Entry.equals(java.lang.Object).

Specified by:
equals in interface java.util.Map.Entry
Overrides:
equals in class java.lang.Object
Returns:
the computed hash code.

getKey

public final java.lang.Object getKey()
Returns the key of this entry.

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

getValue

public final java.lang.Object getValue()
Returns the value of this entry. Note that this will be the value passed to the constructor or the last value passed to setValue(java.lang.Object). It will not reflect changes made to a Map.

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

setValue

public java.lang.Object setValue(java.lang.Object newValue)
Changes the value of this entry. Note that this will change the value in this entry object but will not change the value in a Map.

Specified by:
setValue in interface java.util.Map.Entry
Returns:
the value of this entry.

toString

public java.lang.String toString()
Converts the entry to a string representation for debugging.

Overrides:
toString in class java.lang.Object
Returns:
the string representation.