Reputation: 186
Given: a List<Map<String,String>>
.
I want to get List<String>
of values of the map.
Upvotes: 2
Views: 80
Reputation: 242
List<String> valuesList = new ArrayList<>(yourmap.values());
https://www.tutorialspoint.com/Java-program-to-convert-the-contents-of-a-Map-to-list
Upvotes: -1
Reputation: 464
If I understand correctly what you mean you can do something like this :
List<Map<String, String>> listOfMaps = ...;
List<String> values = listOfMaps.stream()
.flatMap(map -> map.values().stream())
.collect(Collectors.toList());
Upvotes: 5