com.sleepycat.collections

Class MapEntryParameter

public class MapEntryParameter extends Object implements Entry

A simple Map.Entry implementation that can be used as in input parameter. Since a MapEntryParameter is not obtained from a map, it is not attached to any map in particular. To emphasize that changing this object does not change the map, the MapEntryParameter method always throws UnsupportedOperationException.

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 MapEntryParameter and MapEntryParameter.

Constructor Summary
MapEntryParameter(Object key, Object value)
Creates a map entry with a given key and value.
Method Summary
booleanequals(Object other)
Compares this entry to a given entry as specified by java.util.Map.Entry#equals.
ObjectgetKey()
Returns the key of this entry.
ObjectgetValue()
Returns the value of this entry.
inthashCode()
Computes a hash code as specified by java.util.Map.Entry#hashCode.
ObjectsetValue(Object newValue)
Always throws UnsupportedOperationException since this object is not attached to a map.
StringtoString()
Converts the entry to a string representation for debugging.

Constructor Detail

MapEntryParameter

public MapEntryParameter(Object key, 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

equals

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

Returns: the computed hash code.

getKey

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

Returns: the key of this entry.

getValue

public final 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 MapEntryParameter. It will not reflect changes made to a Map.

Returns: the value of this entry.

hashCode

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

Returns: the computed hash code.

setValue

public Object setValue(Object newValue)
Always throws UnsupportedOperationException since this object is not attached to a map.

toString

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

Returns: the string representation.