public static void removeAllSummerPeople(HashMap<String, Date> map) {
HashMap<String, Date> copy = new HashMap<>(map);
for (String key : copy.keySet()) {
Date date = copy.get(key);
int month = date.getMonth() + 1;
if (month == 6 || month == 7 || month == 8) {
map.remove(key);
}
}
}
int month = date.getMonth() + 1; 这里 获取月份 为什么要 加1 啊
求大佬 救救迷茫的我
已解决
评论 (2)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
Gellert Varga
16 二月 2022, 21:47解决方法
Because in the Date object, 0 (not 1) represents the first month (=January).
+3
代码没写完啊~
17 二月 2022, 01:10
感谢大佬💪
0