# Class ArrayValueMap (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.ArrayValueMap)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.util.ArrayValueMap)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.util.ArrayValueMap)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.util.ArrayValueMap)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.util.ArrayValueMap)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.util.ArrayValueMap)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.util.ArrayValueMap)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.util.ArrayValueMap)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.util.ArrayValueMap)

    public final class ArrayValueMap

Collects the array values of a key/value data object, writing the fields or map values only after
all values have been collected.

The typical application for this is when parsing JSON or XML when the value type is known to
be an array. It stores the values in a collection during the parsing, and only when the parsing
of an object is finished does it convert the collection into an array and stores it.

Use [#put(String, Class, Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.ArrayValueMap#com_google_api_client_util_ArrayValueMap_put_java_lang_String_java_lang_Class____java_lang_Object_) when the destination object is a map with string keys
and whose values accept an array of objects. Use [#put(Field, Class, Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.ArrayValueMap#com_google_api_client_util_ArrayValueMap_put_java_lang_reflect_Field_java_lang_Class____java_lang_Object_) when setting
the value of a field using reflection, assuming its type accepts an array of objects. One can
potentially use both `put` methods for example on an instance of [GenericData](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData).

Implementation is not thread-safe. For a thread-safe choice instead use an implementation of
ConcurrentMap.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ArrayValueMap

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### ArrayValueMap(Object destination)

    public ArrayValueMap(Object destination)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `destination` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` destination object whose fields must be set, or destination map whose values must be set |

## Methods

### put(String keyName, Class\<?\> arrayComponentType, Object value)

    public void put(String keyName, Class<?> arrayComponentType, Object value)

Puts an additional value for the given key name, accumulating values on repeated calls on the
same key name.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `keyName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` key name |
| `arrayComponentType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<?>` array component type |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` value |

### put(Field field, Class\<?\> arrayComponentType, Object value)

    public void put(Field field, Class<?> arrayComponentType, Object value)

Puts an additional value for the given field, accumulating values on repeated calls on the same
field.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `field` | `https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html` field |
| `arrayComponentType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<?>` array component type |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` value |

### setValues()

    public void setValues()

Sets the fields of the given object using the values collected during parsing of the object's
fields.