【发布时间】:2016-02-13 17:43:01
【问题描述】:
您好,我有一个包含日期的数组列表
ArrayList 日期 = new ArrayList();
我有类似的日期列表:
All dates between:2015-10-29
All dates between:2015-10-30
All dates between:2015-10-31
All dates between:2015-11-01
All dates between:2015-11-02
All dates between:2015-11-03
我有一个类似 Hashmap 的东西
HashMap<String,String> segCount=userSegmentDAO.getDateWiseCount(user.getOrgId(), startDate, end_Date,fromDate,endDate);
我在哪里获得价值,比如
2015-10-29 6
2015-10-31 3
2015-11-02 5
这里没有我想要的,我一直遍历数组列表直到最后,并且想要与 hashmap 进行比较,如果 hash map conatian 该日期作为键,然后保留它,否则将该日期作为键放在 hashmap 中并放置 0 作为值.
【问题讨论】:
-
containsKey()不工作吗? -
为什么您的地图映射来自 String 而不是来自 Date?