KvSwap extends PTransform<PCollection<KV<K, V>>, PCollection<KV<V, K>>> { public static <K, V> KvSwap<K, V> create() { return new KvSwap<>(); } private  KvSwap(); static KvSwap<K, V> create(); @Override PCollection<KV<V, K>> expand(PCollection<KV<K, V>> in);  }
@Test @Category(NeedsRunner.class) public void testKvSwapEmpty() { PCollection<KV<String, Integer>> input = p.apply( Create.of(Arrays.asList(EMPTY_TABLE)) .withCoder(KvCoder.of(StringUtf8Coder.of(), BigEndianIntegerCoder.of()))); PCollection<KV<Integer, String>> output = input.apply(KvSwap.create()); PAssert.that(output).empty(); p.run(); }