![]() ![]() ![]() ![]() If you are doing an operation on a list, which in turn generates a collection for each one of the input elements, consider if flatMap can help you simplify your code! As desired, we end up with a plain list of elements – the list of characters from the names of the original collection. Next, that collection of collections gets flattened. In the example above, the function that we provide creates a list for each element in our input collection, containing the letters of the original string. Enter fullscreen mode Exit fullscreen mode ![]()
0 Comments
Leave a Reply. |