I have a LinkedHashMap < String, String > map
.
List < String > keyList;
List < String > valueList;
map.keySet();
map.values();
Is there an easy way to populate keyList from map.keySet() and valueList from map.values(), or do I have to iterate?
Most collections accept Collection
as a constructor argument:
List<String> keyList = new ArrayList<String>(map.keySet());
List<String> valueList = new ArrayList<String>(map.values());