title: “Keys”

Keys

Takes a collection of key-value pairs, and returns the key of each element.

Examples

Example

{{< highlight java >}} PCollection<KV<String, Integer>> keyValuePairs = /* ... */; PCollection keys = keyValuePairs.apply(Keys.create()); {{< /highlight >}}

Related transforms

  • KvSwap swaps key-value pair values.
  • Values for extracting the value of each element.
  • WithKeys for adding a key to each element.