如何将地图转换为Java列表?

如何将地图转换为Java列表?

问题描述:

地图< key,value> 转换为列表<值> 的最佳方法是什么?

What is the best way to convert a Map<key,value> to a List<value>? Just iterate over all values and insert them in a list or am I overlooking something?

List<Value> list = new ArrayList<Value>(map.values());

假设:

Map<Key,Value> map;