K
- the type of the keys in this mapV
- the type of the values in this mappublic interface IterableMap<K,V> extends Map<K,V>
A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or use Map Entry objects.
IterableMap<String,Integer> map = new HashedMap<String,Integer>(); MapIterator<String,Integer> it = map.mapIterator(); while (it.hasNext()) { String key = it.next(); Integer value = it.getValue(); it.setValue(value + 1); }
Modifier and Type | Method and Description |
---|---|
void |
clear() |
MapIterator<K,V> |
mapIterator()
Obtains a
MapIterator over the map. |
V |
put(K key,
V value)
Note that the return type is Object, rather than V as in the Map interface.
|
void |
putAll(Map<? extends K,? extends V> t) |
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
void clear()
clear
in interface Map<K,V>
Map.clear()
V put(K key, V value)
put
in interface Map<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keykey
, or
null
if there was no mapping for key
.
(A null
return can also indicate that the map
previously associated null
with key
,
if the implementation supports null
values.)Map.put(Object, Object)
void putAll(Map<? extends K,? extends V> t)
putAll
in interface Map<K,V>
t
- mappings to be stored in this mapMap.putAll(Map)
MapIterator<K,V> mapIterator()
MapIterator
over the map.
A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or use Map Entry objects.
IterableMap<String,Integer> map = new HashedMap<String,Integer>(); MapIterator<String,Integer> it = map.mapIterator(); while (it.hasNext()) { String key = it.next(); Integer value = it.getValue(); it.setValue(value + 1); }
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.