From ea18282f4c3f5cd02afdb49ec6dcda4f56501db4 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 12 Apr 2017 09:31:03 +0300 Subject: [PATCH] Minor: reformat docs to distinguish summary --- .../stdlib/src/kotlin/collections/Maps.kt | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index a77367c2c44..a304080b973 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -24,17 +24,21 @@ private object EmptyMap : Map, Serializable { } /** - * Returns an empty read-only map of specified type. The returned map is serializable (JVM). + * Returns an empty read-only map of specified type. + * + * The returned map is serializable (JVM). * @sample samples.collections.Maps.Instantiation.emptyReadOnlyMap */ public fun emptyMap(): Map = @Suppress("UNCHECKED_CAST") (EmptyMap as Map) /** * Returns a new read-only map with the specified contents, given as a list of pairs - * where the first value is the key and the second is the value. If multiple pairs have - * the same key, the resulting map will contain the value from the last of those pairs. + * where the first value is the key and the second is the value. + * + * If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs. * * Entries of the map are iterated in the order they were specified. + * * The returned map is serializable (JVM). * * @sample samples.collections.Maps.Instantiation.mapFromPairs @@ -42,7 +46,9 @@ public fun emptyMap(): Map = @Suppress("UNCHECKED_CAST") (EmptyMap public fun mapOf(vararg pairs: Pair): Map = if (pairs.size > 0) linkedMapOf(*pairs) else emptyMap() /** - * Returns an empty read-only map. The returned map is serializable (JVM). + * Returns an empty read-only map. + * + * The returned map is serializable (JVM). * @sample samples.collections.Maps.Instantiation.emptyReadOnlyMap */ @kotlin.internal.InlineOnly @@ -50,7 +56,10 @@ public inline fun mapOf(): Map = emptyMap() /** * Returns an immutable map, mapping only the specified key to the - * specified value. The returned map is serializable. + * specified value. + * + * The returned map is serializable. + * * @sample samples.collections.Maps.Instantiation.mapFromPairs */ @JvmVersion @@ -68,9 +77,12 @@ public inline fun mutableMapOf(): MutableMap = LinkedHashMap() /** * Returns a new [MutableMap] with the specified contents, given as a list of pairs - * where the first component is the key and the second is the value. If multiple pairs have - * the same key, the resulting map will contain the value from the last of those pairs. + * where the first component is the key and the second is the value. + * + * If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs. + * * Entries of the map are iterated in the order they were specified. + * * @sample samples.collections.Maps.Instantiation.mutableMapFromPairs * @sample samples.collections.Maps.Instantiation.emptyMutableMap */ @@ -102,8 +114,10 @@ public inline fun linkedMapOf(): LinkedHashMap = LinkedHashMap Map.isNotEmpty(): Boolean = !isEmpty() public inline fun Map?.orEmpty() : Map = this ?: emptyMap() /** - * Checks if the map contains the given key. This method allows to use the `x in map` syntax for checking - * whether an object is contained in the map. + * Checks if the map contains the given key. + * + * This method allows to use the `x in map` syntax for checking whether an object is contained in the map. */ @kotlin.internal.InlineOnly public inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map.contains(key: K) : Boolean = containsKey(key) @@ -206,6 +221,7 @@ public inline operator fun Map.Entry.component1(): K = key /** * Returns the value component of the map entry. + * * This method allows to use destructuring declarations when working with maps, for example: * ``` * for ((key, value) in map) {