How do maps work in Protocol Buffers and how are they represented on the wire?
Last updated
A
map<K, V>is syntactic sugar: on the wire it is identical to a repeated message of entries withkey = 1andvalue = 2.Keys must be integral or string types (no float, bytes, or messages). Values can be any type except another map.
Entry order is unspecified (non-deterministic serialization) and duplicate keys resolve as last-one-wins.