diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index 0e13baa3c15..ded00d787a0 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -488,6 +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. */ public fun Iterable>.toMap(): Map { if (this is Collection) { @@ -510,6 +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. */ public fun Array>.toMap(): Map = when (size) { 0 -> emptyMap() @@ -527,6 +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. */ public fun Sequence>.toMap(): Map = toMap(LinkedHashMap()).optimizeReadOnlyMap()