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>
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 extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
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 intprivate static voidcheckForNullKeysAndValues(Map<?, ?> m) voidclear()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 voidentrySet()booleanChecks whether two map fields are equal.private static boolean(package private) static <K,V> boolean Checks whether twoMaps are equal.inthashCode()booleanReturns whether this field can be modified.voidMakes this field immutable.voidmergeFrom(MapFieldLite<K, V> other) Returns a deep copy of this map field.voidMethods inherited from class java.util.LinkedHashMap
containsValue, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, size
-
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 ofMapbecause 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()
-