FlatMapElements

The Beam SDKs provide language-specific ways to simplify how you provide your DoFn implementation.

FlatMapElements can be used to simplify DoFn that maps an element to multiple elements (one to many).

Kata: Implement a function that maps each input sentence into words tokenized by whitespace (" ") using FlatMapElements.into(...).via(...).


Use FlatMapElements.into(...).via(...).
Refer to the Beam Programming Guide "Lightweight DoFns and other abstractions" section for more information.