map中存放list<实体类>解析

package com;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

 

public class test {
public static void main(String[] args) throws ParseException {
DecomposeVO vo=new DecomposeVO();
vo.setName("hello");
vo.setNum(5);
DecomposeVO co=new DecomposeVO();
co.setName("wasai");
co.setNum(25);
Map<String,List<DecomposeVO>> map = new HashMap<String,List<DecomposeVO>>();
List<DecomposeVO> list = new ArrayList<DecomposeVO>();
list.add(vo);
list.add(co);
map.put("1", list);
//map.put("2", list);
Set<String> keys = map.keySet(); //获取所有的key值
//List<User> userList = null;

for(String key: keys){
System.out.println(key);
}
for(DecomposeVO user:list){
System.out.println(user.getName() + user.getNum() );
}
}
}

posted @ 2017-07-06 11:15  烟雨观春柳  阅读(17257)  评论(0编辑  收藏  举报