获取现在时间;
转化list<Date>列表格式;
把把List列表中的两个List分出来
LocalDate date = LocalDate.now();//获取现在的时间 System.out.println(date); final List<GraphUser> graphUsers = graphDAO.selectGraphUser(date); System.out.println("graphUsers:"+graphUsers); SimpleDateFormat sim = new SimpleDateFormat("yyyy.MM.dd"); List<Date> dateList = graphUsers.stream().map(GraphUser::getUserDate).collect(Collectors.toList());//获取期中的UserDate列表 List<Integer> countList = graphUsers.stream().map(GraphUser::getCount).collect(Collectors.toList()); System.out.println(dateList); System.out.println(countList); final Iterator<Date> iterator = dateList.iterator();//迭代器 List<String> list = new ArrayList<>();//创建一个空列表 while (iterator.hasNext()){//如果有,则返回true final Date next = iterator.next();// list.add(sim.format(next)); } System.out.println(list);
标签:iterator,List,System,graphUsers,转化,println,Date,格式,out From: https://www.cnblogs.com/lin-07/p/17287190.html