Add map() documentation sample

* docs: add map() sample
* docs: add samples for Map and CharSequence
* docs: add another sample for Maps.map()
This commit is contained in:
Benjamin Orsini
2019-05-20 18:20:09 +02:00
committed by ilya-g
parent 08ea982688
commit 3e39f26379
10 changed files with 69 additions and 1 deletions
@@ -58,6 +58,8 @@ public inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo
/**
* Returns a list containing the results of applying the given [transform] function
* to each entry in the original map.
*
* @sample samples.collections.Maps.Transformations.mapToList
*/
public inline fun <K, V, R> Map<out K, V>.map(transform: (Map.Entry<K, V>) -> R): List<R> {
return mapTo(ArrayList<R>(size), transform)