MapCoder extends StructuredCoder<Map<K, V>> { public static <K, V> MapCoder<K, V> of(Coder<K> keyCoder, Coder<V> valueCoder) { return new MapCoder<>(keyCoder, valueCoder); } private  MapCoder(Coder<K> keyCoder, Coder<V> valueCoder); static MapCoder<K, V> of(Coder<K> keyCoder, Coder<V> valueCoder); Coder<K> getKeyCoder(); Coder<V> getValueCoder(); @Override void encode(Map<K, V> map, OutputStream outStream); @Override void encode(Map<K, V> map, OutputStream outStream, Context context); @Override Map<K, V> decode(InputStream inStream); @Override Map<K, V> decode(InputStream inStream, Context context); @Override List<? extends Coder<?>> getCoderArguments(); @Override void verifyDeterministic(); @Override boolean consistentWithEquals(); @Override Object structuralValue(Map<K, V> value); @Override void registerByteSizeObserver(Map<K, V> map, ElementByteSizeObserver observer); @Override TypeDescriptor<Map<K, V>> getEncodedTypeDescriptor();  }
@Test public void testCoderIsSerializableWithWellKnownCoderType() throws Exception { CoderProperties.coderSerializable( MapCoder.of(GlobalWindow.Coder.INSTANCE, GlobalWindow.Coder.INSTANCE)); }
@Test public void testStructuralValueDecodeEncodeEqual() throws Exception { MapCoder<byte[], Integer> coder = MapCoder.of(ByteArrayCoder.of(), VarIntCoder.of()); Map<byte[], Integer> value = Collections.singletonMap(new byte[] {1, 2, 3, 4}, 1); CoderProperties.structuralValueDecodeEncodeEqual(coder, value); }