Package com.google.protobuf

# Class MapFieldBuilder<KeyT,MessageOrBuilderT extends MessageOrBuilder,MessageT extends MessageOrBuilderT,BuilderT extends MessageOrBuilderT>

java.lang.Object
com.google.protobuf.MapFieldReflectionAccessor
com.google.protobuf.MapFieldBuilder<KeyT,MessageOrBuilderT,MessageT,BuilderT>

public class MapFieldBuilder<KeyT,MessageOrBuilderT extends MessageOrBuilder,MessageT extends MessageOrBuilderT,BuilderT extends MessageOrBuilderT> extends MapFieldReflectionAccessor
Internal representation of map fields in generated builders.

This class supports accessing the map field as a `Map` to be used in generated API and also supports accessing the field as a `List` to 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.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`MapFieldBuilder.Converter<KeyT,MessageOrBuilderT extends MessageOrBuilder,MessageT extends MessageOrBuilderT>`
Convert a MessageOrBuilder to a Message regardless of which it holds.

## Constructor Summary

Constructors
Constructor
Description
`MapFieldBuilder(MapFieldBuilder.Converter<KeyT,MessageOrBuilderT,MessageT> converter)`

## Method Summary

Modifier and Type
Method
Description
`MapField<KeyT,MessageT>`
`build(MapEntry<KeyT,MessageT> defaultEntry)`
Converts this MapFieldBuilder to a MapField.
`void`
`clear()`
`MapFieldBuilder<KeyT,MessageOrBuilderT,MessageT,BuilderT>`
`copy()`
Returns a deep copy of this MapFieldBuilder.
`Map<KeyT,MessageOrBuilderT>`
`ensureBuilderMap()`
`List<Message>`
`ensureMessageList()`
`Map<KeyT,MessageT>`
`ensureMessageMap()`
`boolean`
`equals(Object object)`
`Map<KeyT,MessageT>`
`getImmutableMap()`
`int`
`hashCode()`
`void`
`mergeFrom(MapField<KeyT,MessageT> other)`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MapFieldBuilder

public MapFieldBuilder(MapFieldBuilder.Converter<KeyT,MessageOrBuilderT,MessageT> converter)

## Method Details

### ensureBuilderMap

public Map<KeyT,MessageOrBuilderT> ensureBuilderMap()

### ensureMessageList

public List<Message> ensureMessageList()

### ensureMessageMap

public Map<KeyT,MessageT> ensureMessageMap()

### getImmutableMap

public Map<KeyT,MessageT> getImmutableMap()

### mergeFrom

public void mergeFrom(MapField<KeyT,MessageT> other)

### clear

public void clear()

### equals

public boolean equals(Object object)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### copy

public MapFieldBuilder<KeyT,MessageOrBuilderT,MessageT,BuilderT> copy()
Returns a deep copy of this MapFieldBuilder.

### build

public MapField<KeyT,MessageT> build(MapEntry<KeyT,MessageT> defaultEntry)
Converts this MapFieldBuilder to a MapField.