我有一张可变地图
val weeklyCheck = mutableMapOf(
Day.MONDAY to true,
Day.TUESDAY to true,
Day.WEDNESDAY to true,
Day.THURSDAY to true,
Day.FRIDAY to true,
Day.SATURDAY to true,
Day.SUNDAY to true
)
如何将所有键设置为 false。目前我正在使用这样的东西,有没有更好的方法来做到这一点。
private fun resetDays() {
weeklyCheck.put(Days.MONDAY, false)
weeklyCheck.put(Days.TUESDAY, false)
weeklyCheck.put(Days.WEDNESDAY, false)
weeklyCheck.put(Days.THURDSAY, false)
weeklyCheck.put(Days.FRIDAY, false)
weeklyCheck.put(Days.SATURDAY, false)
weeklyCheck.put(Days.SUNDAY, false)
}