Stay organized with collectionsSave and categorize content based on your preferences.
publicclassMapEntryLite<K,V>
Implements the lite version of map entry messages.
This class serves as an utility class to help do serialization/parsing of map entries. It's
used in generated code and also in the full version MapEntry message.
This method is used by generated code to create the default instance for a map entry
message. The created default instance should be used to create new map entry messages of the
same type. For each map entry message, only one default instance should be created.
Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite. This helper method avoids allocation of aMapEntryLitebuilt with
a key and value and is called from generated code directly.
Serializes the provided key and value as though they were wrapped by aMapEntryLiteto
the output stream. This helper method avoids allocation of aMapEntryLitebuilt with a
key and value and is called from generated code directly.
[[["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 MapEntryLite<K,V> (3.19.4)\n\n public class MapEntryLite\u003cK,V\u003e\n\nImplements the lite version of map entry messages.\n\nThis class serves as an utility class to help do serialization/parsing of map entries. It's\nused in generated code and also in the full version MapEntry message.\n\nProtobuf internal. Users shouldn't use. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MapEntryLite\\\u003cK,V\\\u003e \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\\\u003enewDefaultInstance(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)\n\n public static MapEntryLite\u003cK,V\u003e \u003cK,V\u003enewDefaultInstance(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)\n\nCreates a default MapEntryLite message instance.\n\nThis method is used by generated code to create the default instance for a map entry\nmessage. The created default instance should be used to create new map entry messages of the\nsame type. For each map entry message, only one default instance should be created.\n\nMethods\n-------\n\n### computeMessageSize(int fieldNumber, K key, V value)\n\n public int computeMessageSize(int fieldNumber, K key, V value)\n\nComputes the message size for the provided key and value as though they were wrapped by a\n[MapEntryLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapEntryLite). This helper method avoids allocation of a [MapEntryLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapEntryLite) built with\na key and value and is called from generated code directly.\n\n### getKey()\n\n public K getKey()\n\n### getValue()\n\n public V getValue()\n\n### parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry)\n\n public Map.Entry\u003cK,V\u003e parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry)\n\nParses an entry off of the input as a [Map.Entry](https://docs.oracle.com/javase/8/docs/api/java/util/Map/Entry.html). This helper requires an allocation so\nusing #parseInto is preferred if possible.\n\n### parseInto(MapFieldLite\\\u003cK,V\\\u003e map, CodedInputStream input, ExtensionRegistryLite extensionRegistry)\n\n public void parseInto(MapFieldLite\u003cK,V\u003e map, CodedInputStream input, ExtensionRegistryLite extensionRegistry)\n\nParses an entry off of the input into the map. This helper avoids allocation of a [MapEntryLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapEntryLite) by parsing directly into the provided [MapFieldLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapFieldLite).\n\n### serializeTo(CodedOutputStream output, int fieldNumber, K key, V value)\n\n public void serializeTo(CodedOutputStream output, int fieldNumber, K key, V value)\n\nSerializes the provided key and value as though they were wrapped by a [MapEntryLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapEntryLite) to\nthe output stream. This helper method avoids allocation of a [MapEntryLite](/java/docs/reference/protobuf/latest/com.google.protobuf.MapEntryLite) built with a\nkey and value and is called from generated code directly."]]