I am trying to adapt the functions of Lambda, however there is a bit of a struggle here and there.
List<Map<String, String>> list = new LinkedList<>();
Map<String, String> map = new HashMap<>();
map.put("data1", "12345");
map.put("data2", "45678");
list.add(map);
I just want to print the values in comma separated format, like 12345,45678
So here is my test
list.stream().map(Map::values).collect(Collectors.toList())
and the exit is [[12345,45678]]. This means that the list and internal list create a comma separated value in the index 0. I understand why he does it.
But I did not understand how to extract the desired result if I did not name .get(0)at the end of this expression.
Any help / more details on how to use lambdas better would be helpful
Reddy source
share