com.google.cloud.dataflow.sdk.coders

## Class CollectionCoder<T>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.coders.StandardCoder<IterableT>
  - - com.google.cloud.dataflow.sdk.coders.IterableLikeCoder<T,Collection<T>>
    - - com.google.cloud.dataflow.sdk.coders.CollectionCoder<T>

All Implemented Interfaces:
  Coder<Collection<T>>, Serializable

    public class CollectionCoder<T>
    extends IterableLikeCoder<T,Collection<T>>

A `CollectionCoder` encodes `Collections` in the format of `IterableLikeCoder`.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.google.cloud.dataflow.sdk.coders.Coder

`Coder.Context, Coder.NonDeterministicException`

### Constructor Summary

Constructors
`protected` `CollectionCoder(Coder<T> elemCoder)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected Collection<T>` `decodeToIterable(List<T> decodedElements)` Builds an instance of `IterableT`, this coder's associated `Iterable`-like subtype, from a list of decoded elements.
`static <T> List<Object>` `getInstanceComponents(Collection<T> exampleValue)` Returns the first element in this collection if it is non-empty, otherwise returns `null`.
`static <T> CollectionCoder<T>` `of(Coder<T> elemCoder)`
`static CollectionCoder<?>` `of(List<Object> components)`

### Methods inherited from class com.google.cloud.dataflow.sdk.coders.IterableLikeCoder

`decode, encode, getCoderArguments, getElemCoder, getInstanceComponentsHelper, isRegisterByteSizeObserverCheap, registerByteSizeObserver, verifyDeterministic`

### Methods inherited from class com.google.cloud.dataflow.sdk.coders.StandardCoder

`asCloudObject, consistentWithEquals, equals, getAllowedEncodings, getComponents, getEncodedElementByteSize, getEncodingId, hashCode, structuralValue, toString, verifyDeterministic, verifyDeterministic`

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

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

### Constructor Detail

#### CollectionCoder

    protected CollectionCoder(Coder<T> elemCoder)

### Method Detail

#### of

    public static <T> CollectionCoder<T> of(Coder<T> elemCoder)

#### decodeToIterable

    protected final Collection<T> decodeToIterable(List<T> decodedElements)

Builds an instance of `IterableT`, this coder's associated `Iterable`-like subtype, from a list of decoded elements.

Specified by:
  `decodeToIterable` in class `IterableLikeCoder<T,Collection<T>>`
Returns:
  the decoded elements directly, since `List` is a subtype of `Collection`.

#### of

    public static CollectionCoder<?> of(List<Object> components)

#### getInstanceComponents

    public static <T> List<Object> getInstanceComponents(Collection<T> exampleValue)

Returns the first element in this collection if it is non-empty, otherwise returns `null`.