Package com.google.protobuf
Class MapFieldLite<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
com.google.protobuf.MapFieldLite<K,V>
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,
,V> SequencedMap<K,
V>
Internal representation of map fields in generated lite-runtime messages.
This class is a protobuf implementation detail. Users shouldn't use this class directly.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <K,
V> int calculateHashCodeForMap
(Map<K, V> a) Calculates the hash code for aMap
.private static int
private static void
checkForNullKeysAndValues
(Map<?, ?> m) void
clear()
private static Object
(package private) static <K,
V> Map <K, V> Makes a deep copy of aMap
.static <K,
V> MapFieldLite <K, V> Returns a singleton immutable empty MapFieldLite instance.private void
entrySet()
boolean
Checks whether two map fields are equal.private static boolean
(package private) static <K,
V> boolean Checks whether twoMap
s are equal.int
hashCode()
boolean
Returns whether this field can be modified.void
Makes this field immutable.void
mergeFrom
(MapFieldLite<K, V> other) Returns a deep copy of this map field.void
Methods inherited from class java.util.LinkedHashMap
containsValue, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, putIfAbsent, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, size
Methods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
isMutable
private boolean isMutable -
EMPTY_MAP_FIELD
-
-
Constructor Details
-
MapFieldLite
private MapFieldLite() -
MapFieldLite
-
-
Method Details
-
emptyMapField
Returns a singleton immutable empty MapFieldLite instance. -
mergeFrom
-
entrySet
-
clear
public void clear() -
put
-
put
-
putAll
-
remove
-
checkForNullKeysAndValues
-
equals
-
equals
-
equals
Checks whether two map fields are equal. -
calculateHashCodeForObject
-
calculateHashCodeForMap
Calculates the hash code for aMap
. We don't use the default hash code method ofMap
because for byte arrays and protobuf enums it useObject.hashCode()
. -
hashCode
public int hashCode() -
copy
-
copy
Makes a deep copy of aMap
. Immutable objects in the map will be shared (e.g., integers, strings, immutable messages) and mutable ones will have a copy (e.g., byte arrays, mutable messages). -
mutableCopy
Returns a deep copy of this map field. -
makeImmutable
public void makeImmutable()Makes this field immutable. All subsequent modifications will throw anUnsupportedOperationException
. -
isMutable
public boolean isMutable()Returns whether this field can be modified. -
ensureMutable
private void ensureMutable()
-