We are applying the filter function to the results of the getMessages() function. We pass a lambda block to the filter function, which returns a Boolean for each of the list's elements. The filter function returns a list containing filtered objects. Finally, we use the forEach() function to iterate through the next elements of the list. In the lambda block passed to the forEach function, we print the text property of the current Message to the console.
As a result, the code from the preceding section is going to print the following output to the console:
Je t'aime