In Java Map interface provides three collection
views:Key set,value set, and key-value set.All of them can be converted to List
by using a constructor or addAll() method.The
following snippet of codeshow how to construct an ArrayList from a map.
=============================================================
// key list
List keyList = new ArrayList(map.keySet());
// value list
List valueList = new ArrayList(map.valueSet());
// key-value list
List entryList = new ArrayList(map.entrySet());
=====================================================================
|
No comments:
Post a Comment