T - the type of the elements of the setpublic class SetCoder<T> extends IterableLikeCoder<T,java.util.Set<T>>
Coder.Context| Modifier | Constructor and Description |
|---|---|
protected |
SetCoder(Coder<T> elemCoder) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Set<T> |
decodeToIterable(java.util.List<T> decodedElements)
Builds an instance of the coder's associated
Iterable from a list
of decoded elements. |
static <T> java.util.List<java.lang.Object> |
getInstanceComponents(java.util.Set<T> exampleValue)
Returns the first element in this set if it is non-empty,
otherwise returns
null. |
boolean |
isDeterministic()
Not all sets have a deterministic encoding.
|
static <T> SetCoder<T> |
of(Coder<T> elementCoder)
Produces a SetCoder with the given elementCoder.
|
static SetCoder<?> |
of(java.util.List<java.lang.Object> components)
Dynamically typed constructor for JSON deserialization.
|
decode, encode, getCoderArguments, getElemCoder, getInstanceComponentsHelper, isRegisterByteSizeObserverCheap, registerByteSizeObserverasCloudObject, equals, getComponents, getEncodedElementByteSize, hashCode, toStringpublic static <T> SetCoder<T> of(Coder<T> elementCoder)
public static SetCoder<?> of(java.util.List<java.lang.Object> components)
public boolean isDeterministic()
For example, HashSet comparison does not depend on element order, so
two HashSet instances may be equal but produce different encodings.
isDeterministic in interface Coder<java.util.Set<T>>isDeterministic in class IterableLikeCoder<T,java.util.Set<T>>public static <T> java.util.List<java.lang.Object> getInstanceComponents(java.util.Set<T> exampleValue)
null.protected final java.util.Set<T> decodeToIterable(java.util.List<T> decodedElements)
IterableLikeCoderIterable from a list
of decoded elements. If IT is a supertype of List<T>, the
derived class implementation is permitted to return decodedElements
directly.decodeToIterable in class IterableLikeCoder<T,java.util.Set<T>>