码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA中MAP转LIST

时间:2018-01-06 21:01:00      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:string   public   ash   shm   row   array   color   class   log   

@Test

public void testMap2List() throws Exception{
    Map<String, String> map = new HashMap<String, String>();
    map.put("1", "AA");
    map.put("2", "BB");
    map.put("3", "CC");
    map.put("4", "DD");
 
    Collection<String> valueCollection = map.values();
    final int size = valueCollection.size();
 
    List<String> valueList = new ArrayList<String>(valueCollection);
 
    String[] valueArray = new String[size];
    map.values().toArray(valueArray);
}

JAVA中MAP转LIST

标签:string   public   ash   shm   row   array   color   class   log   

原文地址:https://www.cnblogs.com/lupeng2010/p/8215159.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!