public final class MapFieldLite<K,V> extends HashMap<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from this map.
|
static <K,V> MapFieldLite<K,V> |
emptyMapField()
Returns an singleton immutable empty MapFieldLite instance.
|
Set<Map.Entry<K,V>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
boolean |
equals(Object object)
Checks whether two map fields are equal.
|
int |
hashCode()
Returns the hash code value for this map.
|
boolean |
isMutable()
Returns whether this field can be modified.
|
void |
makeImmutable()
Makes this field immutable.
|
void |
mergeFrom(MapFieldLite<K,V> other) |
MapFieldLite<K,V> |
mutableCopy()
Returns a deep copy of this map field.
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
V |
put(Map.Entry<K,V> entry) |
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this map.
|
V |
remove(Object key)
Removes the mapping for the specified key from this map if present.
|
clone, containsKey, containsValue, get, isEmpty, keySet, size, values
toString
public void clear()
HashMap
public static <K,V> MapFieldLite<K,V> emptyMapField()
public Set<Map.Entry<K,V>> entrySet()
HashMap
Set
view of the mappings contained in this map. The set is backed by the map,
so changes to the map are reflected in the set, and vice-versa. If the map is modified while an
iteration over the set is in progress (except through the iterator's own remove
operation, or through the setValue operation on a map entry returned by the iterator)
the results of the iteration are undefined. The set supports element removal, which removes the
corresponding mapping from the map, via the Iterator.remove, Set.remove,
removeAll, retainAll and clear operations. It does not support the
add or addAll operations.public boolean equals(@Nullable Object object)
equals
in interface Map<K,V>
equals
in class AbstractMap<K,V>
object
- object to be compared for equality with this mapObject.hashCode()
,
HashMap
public int hashCode()
AbstractMap
Object.hashCode()
.
This implementation iterates over entrySet(), calling hashCode()
on each element (entry) in the set, and adding up the results.
hashCode
in interface Map<K,V>
hashCode
in class AbstractMap<K,V>
Map.Entry.hashCode()
,
Object.equals(Object)
,
Set.equals(Object)
public boolean isMutable()
public void makeImmutable()
UnsupportedOperationException
.public void mergeFrom(MapFieldLite<K,V> other)
public MapFieldLite<K,V> mutableCopy()
@Nullable public V put(K key, V value)
HashMap
put
in interface Map<K,V>
put
in class HashMap<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic void putAll(Map<? extends K,? extends V> m)
HashMap
@Nullable public V remove(Object key)
HashMap
remove
in interface Map<K,V>
remove
in class HashMap<K,V>
key
- key whose mapping is to be removed from the map