I have a LinkedHashMap < String, String > map
.
List < String > keyList;
List < String > valueList;
map.keySet();
map.values();
<
A different approach using java 8 -
List valueList = map.values().stream().collect(Collectors.toList());
List keyList = map.keySet().stream().collect(Collectors.toList());
Notes:
stream()
- returns sequence of Object
considering collection (here the map
) as source
Collectors
- Collectors are used to combining the result of processing on the elements of a stream.