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()