Go to the documentation of this file.
31 package com.google.protobuf;
35 import java.util.ArrayList;
36 import java.util.Collection;
37 import java.util.Collections;
38 import java.util.Iterator;
39 import java.util.LinkedHashMap;
40 import java.util.List;
56 public class MapField<
K, V>
implements MutabilityOracle {
113 @SuppressWarnings(
"unchecked")
130 this.isMutable =
true;
133 this.listData =
null;
157 @SuppressWarnings(
"unchecked")
163 List<Message>
listData =
new ArrayList<Message>();
171 Map<K, V>
mapData =
new LinkedHashMap<K, V>();
181 synchronized (
this) {
188 return Collections.unmodifiableMap(
mapData);
212 @SuppressWarnings(
"unchecked")
215 if (!(
object instanceof
MapField)) {
233 List<Message> getList() {
234 if (
mode == StorageMode.MAP) {
235 synchronized (
this) {
236 if (
mode == StorageMode.MAP) {
238 mode = StorageMode.BOTH;
242 return Collections.unmodifiableList(
listData);
246 List<Message> getMutableList() {
247 if (
mode != StorageMode.LIST) {
248 if (
mode == StorageMode.MAP) {
252 mode = StorageMode.LIST;
258 Message getMapEntryMessageDefaultInstance() {
259 return converter.getMessageDefaultInstance();
281 throw new UnsupportedOperationException();
316 public V
get(Object
key) {
329 public V
remove(Object
key) {
335 public void putAll(Map<? extends K, ? extends V>
m) {
337 for (
K key :
m.keySet()) {
339 checkNotNull(
m.get(
key));
423 throw new UnsupportedOperationException();
427 public boolean remove(Object o) {
438 public boolean addAll(Collection<? extends E> c) {
440 throw new UnsupportedOperationException();
524 public boolean remove(Object o) {
535 public boolean addAll(Collection<? extends E> c) {
595 public void remove() {
final Iterator< E > delegate
boolean containsAll(Collection<?> c)
Map< K, V > getMutableMap()
Message convertKeyAndValueToMessage(K key, V value)
boolean contains(Object o)
Message convertKeyAndValueToMessage(K key, V value)
void putAll(Map<? extends K, ? extends V > m)
MapField(Converter< K, V > converter, StorageMode mode, Map< K, V > mapData)
final Converter< K, V > converter
boolean addAll(Collection<? extends E > c)
final MutabilityOracle mutabilityOracle
final Collection< E > delegate
volatile StorageMode mode
final MutabilityOracle mutabilityOracle
void mergeFrom(MapField< K, V > other)
static< K, V > MapField< K, V > newMapField(MapEntry< K, V > defaultEntry)
MutatabilityAwareMap< K, V > mapData
volatile boolean isMutable
void convertMessageToKeyAndValue(Message message, Map< K, V > map)
boolean equals(Object object)
boolean retainAll(Collection<?> c)
boolean removeAll(Collection<?> c)
#define T(upbtypeconst, upbtype, ctype, default_value)
void convertMessageToKeyAndValue(Message message, Map< K, V > map)
GLsizei GLsizei GLuint * obj
boolean removeAll(Collection<?> c)
MapField(MapEntry< K, V > defaultEntry, StorageMode mode, Map< K, V > mapData)
MutatabilityAwareMap< K, V > convertListToMap(List< Message > listData)
boolean containsValue(Object value)
Message getMessageDefaultInstance()
const SETUP_TEARDOWN_TESTCONTEXT char * key
boolean containsKey(Object key)
boolean addAll(Collection<? extends E > c)
static Object copy(Object object)
Message getMessageDefaultInstance()
void convertMessageToKeyAndValue(Message message, Map< K, V > map)
final Map< K, V > delegate
const upb_json_parsermethod * m
final MutabilityOracle mutabilityOracle
ImmutableMessageConverter(MapEntry< K, V > defaultEntry)
final MapEntry< K, V > defaultEntry
List< Message > convertMapToList(MutatabilityAwareMap< K, V > mapData)
final MutabilityOracle mutabilityOracle
boolean retainAll(Collection<?> c)
boolean containsAll(Collection<?> c)
GLsizei const GLfloat * value
boolean contains(Object o)
Set< java.util.Map.Entry< K, V > > entrySet()
GLboolean GLboolean GLboolean GLboolean a
boolean equals(Object obj)
static< K, V > MapField< K, V > emptyMapField(MapEntry< K, V > defaultEntry)
GLenum GLuint GLenum GLsizei const GLchar * message
Message convertKeyAndValueToMessage(K key, V value)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:56