Java Reference
In-Depth Information
The interface
Map.Entry<K,V>
defines methods for manipulating the
entries in the map, as returned from the
Map
interface's
entrySet
method:
public K
getKey()
Returns the key for this entry.
public V
getValue()
Returns the value for this entry.
public V
setValue(V value)
Sets the value for this entry and returns the old value.
Note that there is no
setKey
methodyou change the key by removing the
existing mapping for the original key and adding another mapping under
the new key.
The
SortedMap
interface extends
Map
refining the contract to require that
the keys be sorted. This ordering requirement affects the collections re-
turned by
keySet
,
values
, and
enTRySet
.
SortedMap
also adds methods that
make sense in an ordered map:
public Comparator<? super K>
comparator()
Returns the comparator being used for sorting this map.
Returns
null
if none is being used, which means that the map
is sorted using the keys' natural order.
public K
firstKey()
Returns the first (lowest value) key in this map.
public K
lastKey()
Returns the last (highest value) key in this map.