Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/learnrxjava/ComposableListExercises.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ public static ComposableList<Integer> exercise9() {
/*
Exercise 10: Implement concatMap()

To flatten trees with nested forEach expressions we accumlate the results in a new flat list. Querying a List
To flatten trees with nested forEach expressions we accumulate the results in a new flat list. Querying a List
of data from a Tree is a very common operation. Ideally we'd be able to use a helper function to do the heavy
lifting for us.

Let's implement the concatMap() method for List. Like map(), the concatMap() function applies a projection
function to each item in a list. However the projection function passed to concatMap tranforms each individual
function to each item in a list. However the projection function passed to concatMap transforms each individual
value into a _list of values_, creating a tree structure. Before returning the tree, the concatMap method
flattens the tree by concatenating each inner list together in order. Here's an example of concatMap in action:

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/learnrxjava/ComposableListSolutions.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ public static ComposableList<Integer> exercise9() {
/*
Exercise 10: Implement concatMap()

To flatten trees with nested forEach expressions we accumlate the results in a new flat list. Querying a List
To flatten trees with nested forEach expressions we accumulate the results in a new flat list. Querying a List
of data from a Tree is a very common operation. Ideally we'd be able to use a helper function to do the heavy
lifting for us.

Let's implement the concatMap() method for List. Like map(), the concatMap() function applies a projection
function to each item in a list. However the projection function passed to concatMap tranforms each individual
function to each item in a list. However the projection function passed to concatMap transforms each individual
value into a _list of values_, creating a tree structure. Before returning the tree, the concatMap method
flattens the tree by concatenating each inner list together in order. Here's an example of concatMap in action:

Expand Down