Map<LocalDate, List> mapByUser = GM.me.getLikesRecordMap().get(userId); LocalDate today = LocalDate.now();

// 判断此map的键只能含有today,如果不等于today就先清除不是今天的map if (!mapByUser.containsKey(today)) { mapByUser.clear(); mapByUser.put(today, new ArrayList<>()); }

// 确保这个map中只会有今天日期的键 mapByUser.keySet().retainAll(Collections.singleton(today));

MapLocalDateListLikesRecord mapByUser = GMmegetLikesRecordMapgetuserId; LocalDate today = LocalDatenow;年月日判断此map的键只能含有today 如果不等于today 就先清除不是今天的map保证这个map中只会有今天日期的键