Package net.cscott.jutil
Class AbstractMapEntry<K,V>
java.lang.Object
net.cscott.jutil.AbstractMapEntry<K,V>
- All Implemented Interfaces:
Map.Entry<K,V>
- Direct Known Subclasses:
PairMapEntry
An
AbstractMapEntry takes care of most of the grunge
work involved in subclassing Map.Entry. For
an immutable entry, you need only implement getKey()
and getValue(). For a modifiable entry, you must also
implement setValue(Object); the default implementation throws
an UnsupportedOperationException.- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares the specified object with this entry for equality.abstract KgetKey()Returns the key corresponding to this entry.abstract VgetValue()Returns the value corresponding to this entry.inthashCode()Returns the hash code value for this map entry.Replaces the value corresponding to this entry with the specified value (optional operation).toString()Returns a human-readable representation of this map entry.
-
Constructor Details
-
AbstractMapEntry
public AbstractMapEntry()
-
-
Method Details
-
getKey
Returns the key corresponding to this entry. -
getValue
Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator'sremove()operation), the results of this call are undefined. -
setValue
Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator'sremove()operation). -
toString
Returns a human-readable representation of this map entry. -
equals
Compares the specified object with this entry for equality. Returnstrueif the given object is also a map entry and the two entries represent the same mapping. -
hashCode
public int hashCode()Returns the hash code value for this map entry.
-