Home » Java » Java stream filtering List<Map<String,String>>

Java stream filtering List<Map<String,String>>

Posted by: admin June 30, 2018 Leave a comment

Questions:

I would like to filter a “List of Map” and create a new object using Streams.

For the first step, I’m able to select the entry from the list that matches a specific key:

List<Map<String,String>> listOfItems =...
listOfItems.stream().filter(m -> m.get("name").equals("apple"));

Now, I would like to create an object using the selected Map entry.

Thanks,
Sudha

Answers: