From 800e958f168c876c9d37627d048af2928515f17c Mon Sep 17 00:00:00 2001 From: cubandle Date: Sat, 14 Jan 2023 20:20:57 -0500 Subject: [PATCH] Optimize putLast --- .../commonMain/kotlin/com/katiearose/sobriety/shared/Utils.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/com/katiearose/sobriety/shared/Utils.kt b/shared/src/commonMain/kotlin/com/katiearose/sobriety/shared/Utils.kt index d7cdd78..a679043 100644 --- a/shared/src/commonMain/kotlin/com/katiearose/sobriety/shared/Utils.kt +++ b/shared/src/commonMain/kotlin/com/katiearose/sobriety/shared/Utils.kt @@ -20,6 +20,5 @@ fun DateTimeUnit.toMillis(): Long { * Puts the specified value to the last key in this map. */ fun LinkedHashMap.putLast(value: V) { - val lastKey = keys.map { it }.last() - put(lastKey, value) + put(keys.last(), value) } \ No newline at end of file