From 19906f13ea3f7bc6f507a5411c0ba1c2dc9fa110 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 20 Dec 2018 17:14:13 +0100 Subject: [PATCH] Update Maps.kt --- libraries/stdlib/src/kotlin/collections/Maps.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index ded00d787a0..813798c41a1 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -488,7 +488,7 @@ public inline fun Map.filterNot(predicate: (Map.Entry) -> * Returns a new map containing all key-value pairs from the given collection of pairs. * * The returned map preserves the entry iteration order of the original collection. - * Duplicate keys are ignored except for the last one. + * If any of two pairs would have the same key the last one gets added to the map. */ public fun Iterable>.toMap(): Map { if (this is Collection) { @@ -511,7 +511,7 @@ public fun > Iterable>.toMap(destina * Returns a new map containing all key-value pairs from the given array of pairs. * * The returned map preserves the entry iteration order of the original array. - * Duplicate keys are ignored except for the last one. + * If any of two pairs would have the same key the last one gets added to the map. */ public fun Array>.toMap(): Map = when (size) { 0 -> emptyMap() @@ -529,7 +529,7 @@ public fun > Array>.toMap(destin * Returns a new map containing all key-value pairs from the given sequence of pairs. * * The returned map preserves the entry iteration order of the original sequence. - * Duplicate keys are ignored except for the last one. + * If any of two pairs would have the same key the last one gets added to the map. */ public fun Sequence>.toMap(): Map = toMap(LinkedHashMap()).optimizeReadOnlyMap()