Internal representation of map fields in generated messages.
This class supports accessing the map field as aMapto be used in generated API and
also supports accessing the field as aListto be used in reflection API. It keeps track
of where the data is currently stored and do necessary conversions between map and list.
This class is a protobuf implementation detail. Users shouldn't use this class directly.
THREAD-SAFETY NOTE: Read-only access is thread-safe. Users can call getMap() and getList()
concurrently in multiple threads. If write-access is needed, all access must be synchronized.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class MapField<K,V> (3.19.4)\n\n public class MapField\u003cK,V\u003e implements MutabilityOracle\n\nInternal representation of map fields in generated messages.\n\nThis class supports accessing the map field as a [Map](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html) to be used in generated API and\nalso supports accessing the field as a [List](https://docs.oracle.com/javase/8/docs/api/java/util/List.html) to be used in reflection API. It keeps track\nof where the data is currently stored and do necessary conversions between map and list.\n\nThis class is a protobuf implementation detail. Users shouldn't use this class directly.\n\nTHREAD-SAFETY NOTE: Read-only access is thread-safe. Users can call getMap() and getList()\nconcurrently in multiple threads. If write-access is needed, all access must be synchronized. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MapField\\\u003cK,V\\\u003e \n\nImplements\n----------\n\ncom.google.protobuf.MutabilityOracle \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### \\\u003cK,V\\\u003eemptyMapField(MapEntry\\\u003cK,V\\\u003e defaultEntry)\n\n public static MapField\u003cK,V\u003e \u003cK,V\u003eemptyMapField(MapEntry\u003cK,V\u003e defaultEntry)\n\nReturns an immutable empty MapField.\n\n### \\\u003cK,V\\\u003enewMapField(MapEntry\\\u003cK,V\\\u003e defaultEntry)\n\n public static MapField\u003cK,V\u003e \u003cK,V\u003enewMapField(MapEntry\u003cK,V\u003e defaultEntry)\n\nCreates a new mutable empty MapField.\n\nMethods\n-------\n\n### clear()\n\n public void clear()\n\n### copy()\n\n public MapField\u003cK,V\u003e copy()\n\nReturns a deep copy of this MapField.\n\n### ensureMutable()\n\n public void ensureMutable()\n\nThrows an UnsupportedOperationException if not mutable.\n\n### equals(Object object)\n\n public boolean equals(Object object)\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### getMap()\n\n public Map\u003cK,V\u003e getMap()\n\nReturns the content of this MapField as a read-only Map.\n\n### getMutableMap()\n\n public Map\u003cK,V\u003e getMutableMap()\n\nGets a mutable Map view of this MapField.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### isMutable()\n\n public boolean isMutable()\n\nReturns whether this field can be modified.\n\n### makeImmutable()\n\n public void makeImmutable()\n\nMakes this list immutable. All subsequent modifications will throw an UnsupportedOperationException.\n\n### mergeFrom(MapField\\\u003cK,V\\\u003e other)\n\n public void mergeFrom(MapField\u003cK,V\u003e other)"]]