Package com.sleepycat.collections
Class MapEntryParameter<K,V>
java.lang.Object
com.sleepycat.collections.MapEntryParameter<K,V>
- All Implemented Interfaces:
Map.Entry<K,V>
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 setValue(V) 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 getValue() and setValue(V).
-
Constructor Summary
ConstructorsConstructorDescriptionMapEntryParameter(K key, V value) Creates a map entry with a given key and value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this entry to a given entry as specified byMap.Entry.equals(java.lang.Object).final KgetKey()Returns the key of this entry.final VgetValue()Returns the value of this entry.inthashCode()Computes a hash code as specified byMap.Entry.hashCode().Always throwsUnsupportedOperationExceptionsince this object is not attached to a map.toString()Converts the entry to a string representation for debugging.
-
Constructor Details
-
MapEntryParameter
Creates a map entry with a given key and value.- Parameters:
key- is the key to use.value- is the value to use.
-
-
Method Details
-
hashCode
public int hashCode()Computes a hash code as specified byMap.Entry.hashCode(). -
equals
Compares this entry to a given entry as specified byMap.Entry.equals(java.lang.Object). -
getKey
Returns the key of this entry. -
getValue
Returns the value of this entry. Note that this will be the value passed to the constructor or the last value passed tosetValue(V). It will not reflect changes made to a Map. -
setValue
Always throwsUnsupportedOperationExceptionsince this object is not attached to a map. -
toString
Converts the entry to a string representation for debugging.
-