Docs: preserve empty lines in the generated documentation to separate summary and paragraphs in the body.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -957,7 +957,9 @@ public fun Collection<Short>.toShortArray(): ShortArray {
|
||||
/**
|
||||
* Returns a [Map] containing key-value pairs provided by [transform] function
|
||||
* applied to elements of the given collection.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original collection.
|
||||
*/
|
||||
public inline fun <T, K, V> Iterable<T>.associate(transform: (T) -> Pair<K, V>): Map<K, V> {
|
||||
@@ -969,7 +971,9 @@ public inline fun <T, K, V> Iterable<T>.associate(transform: (T) -> Pair<K, V>):
|
||||
/**
|
||||
* Returns a [Map] containing the elements from the given collection indexed by the key
|
||||
* returned from [keySelector] function applied to each element.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original collection.
|
||||
*/
|
||||
public inline fun <T, K> Iterable<T>.associateBy(keySelector: (T) -> K): Map<K, T> {
|
||||
@@ -980,7 +984,9 @@ public inline fun <T, K> Iterable<T>.associateBy(keySelector: (T) -> K): Map<K,
|
||||
|
||||
/**
|
||||
* Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given collection.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original collection.
|
||||
*/
|
||||
public inline fun <T, K, V> Iterable<T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V> {
|
||||
@@ -993,6 +999,7 @@ public inline fun <T, K, V> Iterable<T>.associateBy(keySelector: (T) -> K, value
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function applied to each element of the given collection
|
||||
* and value is the element itself.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, M : MutableMap<in K, in T>> Iterable<T>.associateByTo(destination: M, keySelector: (T) -> K): M {
|
||||
@@ -1006,6 +1013,7 @@ public inline fun <T, K, M : MutableMap<in K, in T>> Iterable<T>.associateByTo(d
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function and
|
||||
* and value is provided by the [valueTransform] function applied to elements of the given collection.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {
|
||||
@@ -1018,6 +1026,7 @@ public inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateByT
|
||||
/**
|
||||
* Populates and returns the [destination] mutable map with key-value pairs
|
||||
* provided by [transform] function applied to each element of the given collection.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateTo(destination: M, transform: (T) -> Pair<K, V>): M {
|
||||
@@ -1076,6 +1085,7 @@ public fun <T> Collection<T>.toMutableList(): MutableList<T> {
|
||||
|
||||
/**
|
||||
* Returns a [Set] of all elements.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original collection.
|
||||
*/
|
||||
public fun <T> Iterable<T>.toSet(): Set<T> {
|
||||
@@ -1099,6 +1109,7 @@ public fun <T: Comparable<T>> Iterable<T>.toSortedSet(): SortedSet<T> {
|
||||
|
||||
/**
|
||||
* Returns a [SortedSet] of all elements.
|
||||
*
|
||||
* Elements in the set returned are sorted according to the given [comparator].
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@@ -1127,7 +1138,9 @@ public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(dest
|
||||
/**
|
||||
* Groups elements of the original collection by the key returned by the given [keySelector] function
|
||||
* applied to each element and returns a map where each group key is associated with a list of corresponding elements.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original collection.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <T, K> Iterable<T>.groupBy(keySelector: (T) -> K): Map<K, List<T>> {
|
||||
@@ -1138,7 +1151,9 @@ public inline fun <T, K> Iterable<T>.groupBy(keySelector: (T) -> K): Map<K, List
|
||||
* Groups values returned by the [valueTransform] function applied to each element of the original collection
|
||||
* by the key returned by the given [keySelector] function applied to the element
|
||||
* and returns a map where each group key is associated with a list of corresponding values.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original collection.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <T, K, V> Iterable<T>.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, List<V>> {
|
||||
@@ -1148,7 +1163,9 @@ public inline fun <T, K, V> Iterable<T>.groupBy(keySelector: (T) -> K, valueTran
|
||||
/**
|
||||
* Groups elements of the original collection by the key returned by the given [keySelector] function
|
||||
* applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Iterable<T>.groupByTo(destination: M, keySelector: (T) -> K): M {
|
||||
@@ -1164,7 +1181,9 @@ public inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Iterable<T>.group
|
||||
* Groups values returned by the [valueTransform] function applied to each element of the original collection
|
||||
* by the key returned by the given [keySelector] function applied to the element
|
||||
* and puts to the [destination] map each group key associated with a list of corresponding values.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Iterable<T>.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {
|
||||
@@ -1266,6 +1285,7 @@ public fun <T> Iterable<T>.withIndex(): Iterable<IndexedValue<T>> {
|
||||
|
||||
/**
|
||||
* Returns a list containing only distinct elements from the given collection.
|
||||
*
|
||||
* The elements in the resulting list are in the same order as they were in the source collection.
|
||||
*/
|
||||
public fun <T> Iterable<T>.distinct(): List<T> {
|
||||
@@ -1275,6 +1295,7 @@ public fun <T> Iterable<T>.distinct(): List<T> {
|
||||
/**
|
||||
* Returns a list containing only elements from the given collection
|
||||
* having distinct keys returned by the given [selector] function.
|
||||
*
|
||||
* The elements in the resulting list are in the same order as they were in the source collection.
|
||||
*/
|
||||
public inline fun <T, K> Iterable<T>.distinctBy(selector: (T) -> K): List<T> {
|
||||
@@ -1290,6 +1311,7 @@ public inline fun <T, K> Iterable<T>.distinctBy(selector: (T) -> K): List<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements that are contained by both this set and the specified collection.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original collection.
|
||||
*/
|
||||
public infix fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T> {
|
||||
@@ -1300,6 +1322,7 @@ public infix fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements that are contained by this collection and not contained by the specified collection.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original collection.
|
||||
*/
|
||||
public infix fun <T> Iterable<T>.subtract(other: Iterable<T>): Set<T> {
|
||||
@@ -1310,6 +1333,7 @@ public infix fun <T> Iterable<T>.subtract(other: Iterable<T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a mutable set containing all distinct elements from the given collection.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original collection.
|
||||
*/
|
||||
public fun <T> Iterable<T>.toMutableSet(): MutableSet<T> {
|
||||
@@ -1321,6 +1345,7 @@ public fun <T> Iterable<T>.toMutableSet(): MutableSet<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all distinct elements from both collections.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original collection.
|
||||
* Those elements of the [other] collection that are unique are iterated in the end
|
||||
* in the order of the [other] collection.
|
||||
@@ -1887,6 +1912,7 @@ public inline fun <T, R, V> Iterable<T>.zip(other: Iterable<R>, transform: (T, R
|
||||
|
||||
/**
|
||||
* Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
|
||||
*
|
||||
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
|
||||
* elements will be appended, followed by the [truncated] string (which defaults to "...").
|
||||
*/
|
||||
@@ -1909,6 +1935,7 @@ public fun <T, A : Appendable> Iterable<T>.joinTo(buffer: A, separator: CharSequ
|
||||
|
||||
/**
|
||||
* Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
|
||||
*
|
||||
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
|
||||
* elements will be appended, followed by the [truncated] string (which defaults to "...").
|
||||
*/
|
||||
|
||||
@@ -255,6 +255,7 @@ public operator fun ClosedRange<Float>.contains(value: Short): Boolean {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Byte): IntProgression {
|
||||
@@ -263,6 +264,7 @@ public infix fun Int.downTo(to: Byte): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Byte): LongProgression {
|
||||
@@ -271,6 +273,7 @@ public infix fun Long.downTo(to: Byte): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Byte): IntProgression {
|
||||
@@ -279,6 +282,7 @@ public infix fun Byte.downTo(to: Byte): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Byte): IntProgression {
|
||||
@@ -287,6 +291,7 @@ public infix fun Short.downTo(to: Byte): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Char.downTo(to: Char): CharProgression {
|
||||
@@ -295,6 +300,7 @@ public infix fun Char.downTo(to: Char): CharProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Int): IntProgression {
|
||||
@@ -303,6 +309,7 @@ public infix fun Int.downTo(to: Int): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Int): LongProgression {
|
||||
@@ -311,6 +318,7 @@ public infix fun Long.downTo(to: Int): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Int): IntProgression {
|
||||
@@ -319,6 +327,7 @@ public infix fun Byte.downTo(to: Int): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Int): IntProgression {
|
||||
@@ -327,6 +336,7 @@ public infix fun Short.downTo(to: Int): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Long): LongProgression {
|
||||
@@ -335,6 +345,7 @@ public infix fun Int.downTo(to: Long): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Long): LongProgression {
|
||||
@@ -343,6 +354,7 @@ public infix fun Long.downTo(to: Long): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Long): LongProgression {
|
||||
@@ -351,6 +363,7 @@ public infix fun Byte.downTo(to: Long): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Long): LongProgression {
|
||||
@@ -359,6 +372,7 @@ public infix fun Short.downTo(to: Long): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Int.downTo(to: Short): IntProgression {
|
||||
@@ -367,6 +381,7 @@ public infix fun Int.downTo(to: Short): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Long.downTo(to: Short): LongProgression {
|
||||
@@ -375,6 +390,7 @@ public infix fun Long.downTo(to: Short): LongProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Byte.downTo(to: Short): IntProgression {
|
||||
@@ -383,6 +399,7 @@ public infix fun Byte.downTo(to: Short): IntProgression {
|
||||
|
||||
/**
|
||||
* Returns a progression from this value down to the specified [to] value with the step -1.
|
||||
*
|
||||
* The [to] value has to be less than this value.
|
||||
*/
|
||||
public infix fun Short.downTo(to: Short): IntProgression {
|
||||
@@ -464,6 +481,7 @@ public infix fun Short.until(to: Byte): IntRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Char.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Char.until(to: Char): CharRange {
|
||||
@@ -474,6 +492,7 @@ public infix fun Char.until(to: Char): CharRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Int.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Int.until(to: Int): IntRange {
|
||||
@@ -491,6 +510,7 @@ public infix fun Long.until(to: Int): LongRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Int.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Byte.until(to: Int): IntRange {
|
||||
@@ -501,6 +521,7 @@ public infix fun Byte.until(to: Int): IntRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Int.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Short.until(to: Int): IntRange {
|
||||
@@ -511,6 +532,7 @@ public infix fun Short.until(to: Int): IntRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Long.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Int.until(to: Long): LongRange {
|
||||
@@ -521,6 +543,7 @@ public infix fun Int.until(to: Long): LongRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Long.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Long.until(to: Long): LongRange {
|
||||
@@ -531,6 +554,7 @@ public infix fun Long.until(to: Long): LongRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Long.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Byte.until(to: Long): LongRange {
|
||||
@@ -541,6 +565,7 @@ public infix fun Byte.until(to: Long): LongRange {
|
||||
|
||||
/**
|
||||
* Returns a range from this value up to but excluding the specified [to] value.
|
||||
*
|
||||
* The [to] value must be greater than [Long.MIN_VALUE].
|
||||
*/
|
||||
public infix fun Short.until(to: Long): LongRange {
|
||||
@@ -579,6 +604,7 @@ public infix fun Short.until(to: Short): IntRange {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun <T: Comparable<T>> T.coerceAtLeast(minimumValue: T): T {
|
||||
@@ -587,6 +613,7 @@ public fun <T: Comparable<T>> T.coerceAtLeast(minimumValue: T): T {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Byte.coerceAtLeast(minimumValue: Byte): Byte {
|
||||
@@ -595,6 +622,7 @@ public fun Byte.coerceAtLeast(minimumValue: Byte): Byte {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Short.coerceAtLeast(minimumValue: Short): Short {
|
||||
@@ -603,6 +631,7 @@ public fun Short.coerceAtLeast(minimumValue: Short): Short {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Int.coerceAtLeast(minimumValue: Int): Int {
|
||||
@@ -611,6 +640,7 @@ public fun Int.coerceAtLeast(minimumValue: Int): Int {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Long.coerceAtLeast(minimumValue: Long): Long {
|
||||
@@ -619,6 +649,7 @@ public fun Long.coerceAtLeast(minimumValue: Long): Long {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Float.coerceAtLeast(minimumValue: Float): Float {
|
||||
@@ -627,6 +658,7 @@ public fun Float.coerceAtLeast(minimumValue: Float): Float {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not less than the specified [minimumValue].
|
||||
*
|
||||
* @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
|
||||
*/
|
||||
public fun Double.coerceAtLeast(minimumValue: Double): Double {
|
||||
@@ -635,6 +667,7 @@ public fun Double.coerceAtLeast(minimumValue: Double): Double {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun <T: Comparable<T>> T.coerceAtMost(maximumValue: T): T {
|
||||
@@ -643,6 +676,7 @@ public fun <T: Comparable<T>> T.coerceAtMost(maximumValue: T): T {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Byte.coerceAtMost(maximumValue: Byte): Byte {
|
||||
@@ -651,6 +685,7 @@ public fun Byte.coerceAtMost(maximumValue: Byte): Byte {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Short.coerceAtMost(maximumValue: Short): Short {
|
||||
@@ -659,6 +694,7 @@ public fun Short.coerceAtMost(maximumValue: Short): Short {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Int.coerceAtMost(maximumValue: Int): Int {
|
||||
@@ -667,6 +703,7 @@ public fun Int.coerceAtMost(maximumValue: Int): Int {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Long.coerceAtMost(maximumValue: Long): Long {
|
||||
@@ -675,6 +712,7 @@ public fun Long.coerceAtMost(maximumValue: Long): Long {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Float.coerceAtMost(maximumValue: Float): Float {
|
||||
@@ -683,6 +721,7 @@ public fun Float.coerceAtMost(maximumValue: Float): Float {
|
||||
|
||||
/**
|
||||
* Ensures that this value is not greater than the specified [maximumValue].
|
||||
*
|
||||
* @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
|
||||
*/
|
||||
public fun Double.coerceAtMost(maximumValue: Double): Double {
|
||||
@@ -691,6 +730,7 @@ public fun Double.coerceAtMost(maximumValue: Double): Double {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun <T: Comparable<T>> T.coerceIn(minimumValue: T?, maximumValue: T?): T {
|
||||
@@ -708,6 +748,7 @@ public fun <T: Comparable<T>> T.coerceIn(minimumValue: T?, maximumValue: T?): T
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Byte.coerceIn(minimumValue: Byte, maximumValue: Byte): Byte {
|
||||
@@ -719,6 +760,7 @@ public fun Byte.coerceIn(minimumValue: Byte, maximumValue: Byte): Byte {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Short.coerceIn(minimumValue: Short, maximumValue: Short): Short {
|
||||
@@ -730,6 +772,7 @@ public fun Short.coerceIn(minimumValue: Short, maximumValue: Short): Short {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Int.coerceIn(minimumValue: Int, maximumValue: Int): Int {
|
||||
@@ -741,6 +784,7 @@ public fun Int.coerceIn(minimumValue: Int, maximumValue: Int): Int {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long {
|
||||
@@ -752,6 +796,7 @@ public fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float {
|
||||
@@ -763,6 +808,7 @@ public fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
|
||||
*
|
||||
* @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
|
||||
*/
|
||||
public fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double {
|
||||
@@ -774,6 +820,7 @@ public fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified [range].
|
||||
*
|
||||
* @return this value if it's in the [range], or range.start if this value is less than range.start, or range.end if this value is greater than range.end.
|
||||
*/
|
||||
public fun <T: Comparable<T>> T.coerceIn(range: ClosedRange<T>): T {
|
||||
@@ -783,6 +830,7 @@ public fun <T: Comparable<T>> T.coerceIn(range: ClosedRange<T>): T {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified [range].
|
||||
*
|
||||
* @return this value if it's in the [range], or range.start if this value is less than range.start, or range.end if this value is greater than range.end.
|
||||
*/
|
||||
public fun Int.coerceIn(range: ClosedRange<Int>): Int {
|
||||
@@ -792,6 +840,7 @@ public fun Int.coerceIn(range: ClosedRange<Int>): Int {
|
||||
|
||||
/**
|
||||
* Ensures that this value lies in the specified [range].
|
||||
*
|
||||
* @return this value if it's in the [range], or range.start if this value is less than range.start, or range.end if this value is greater than range.end.
|
||||
*/
|
||||
public fun Long.coerceIn(range: ClosedRange<Long>): Long {
|
||||
|
||||
@@ -456,7 +456,9 @@ public fun <T> Sequence<T>.sortedWith(comparator: Comparator<in T>): Sequence<T>
|
||||
/**
|
||||
* Returns a [Map] containing key-value pairs provided by [transform] function
|
||||
* applied to elements of the given sequence.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original sequence.
|
||||
*/
|
||||
public inline fun <T, K, V> Sequence<T>.associate(transform: (T) -> Pair<K, V>): Map<K, V> {
|
||||
@@ -466,7 +468,9 @@ public inline fun <T, K, V> Sequence<T>.associate(transform: (T) -> Pair<K, V>):
|
||||
/**
|
||||
* Returns a [Map] containing the elements from the given sequence indexed by the key
|
||||
* returned from [keySelector] function applied to each element.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original sequence.
|
||||
*/
|
||||
public inline fun <T, K> Sequence<T>.associateBy(keySelector: (T) -> K): Map<K, T> {
|
||||
@@ -475,7 +479,9 @@ public inline fun <T, K> Sequence<T>.associateBy(keySelector: (T) -> K): Map<K,
|
||||
|
||||
/**
|
||||
* Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given sequence.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original sequence.
|
||||
*/
|
||||
public inline fun <T, K, V> Sequence<T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V> {
|
||||
@@ -486,6 +492,7 @@ public inline fun <T, K, V> Sequence<T>.associateBy(keySelector: (T) -> K, value
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function applied to each element of the given sequence
|
||||
* and value is the element itself.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, M : MutableMap<in K, in T>> Sequence<T>.associateByTo(destination: M, keySelector: (T) -> K): M {
|
||||
@@ -499,6 +506,7 @@ public inline fun <T, K, M : MutableMap<in K, in T>> Sequence<T>.associateByTo(d
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function and
|
||||
* and value is provided by the [valueTransform] function applied to elements of the given sequence.
|
||||
*
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, in V>> Sequence<T>.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {
|
||||
@@ -511,6 +519,7 @@ public inline fun <T, K, V, M : MutableMap<in K, in V>> Sequence<T>.associateByT
|
||||
/**
|
||||
* Populates and returns the [destination] mutable map with key-value pairs
|
||||
* provided by [transform] function applied to each element of the given sequence.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, in V>> Sequence<T>.associateTo(destination: M, transform: (T) -> Pair<K, V>): M {
|
||||
@@ -553,6 +562,7 @@ public fun <T> Sequence<T>.toMutableList(): MutableList<T> {
|
||||
|
||||
/**
|
||||
* Returns a [Set] of all elements.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original sequence.
|
||||
*/
|
||||
public fun <T> Sequence<T>.toSet(): Set<T> {
|
||||
@@ -569,6 +579,7 @@ public fun <T: Comparable<T>> Sequence<T>.toSortedSet(): SortedSet<T> {
|
||||
|
||||
/**
|
||||
* Returns a [SortedSet] of all elements.
|
||||
*
|
||||
* Elements in the set returned are sorted according to the given [comparator].
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@@ -597,7 +608,9 @@ public inline fun <T, R, C : MutableCollection<in R>> Sequence<T>.flatMapTo(dest
|
||||
/**
|
||||
* Groups elements of the original sequence by the key returned by the given [keySelector] function
|
||||
* applied to each element and returns a map where each group key is associated with a list of corresponding elements.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original sequence.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <T, K> Sequence<T>.groupBy(keySelector: (T) -> K): Map<K, List<T>> {
|
||||
@@ -608,7 +621,9 @@ public inline fun <T, K> Sequence<T>.groupBy(keySelector: (T) -> K): Map<K, List
|
||||
* Groups values returned by the [valueTransform] function applied to each element of the original sequence
|
||||
* by the key returned by the given [keySelector] function applied to the element
|
||||
* and returns a map where each group key is associated with a list of corresponding values.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original sequence.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <T, K, V> Sequence<T>.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, List<V>> {
|
||||
@@ -618,7 +633,9 @@ public inline fun <T, K, V> Sequence<T>.groupBy(keySelector: (T) -> K, valueTran
|
||||
/**
|
||||
* Groups elements of the original sequence by the key returned by the given [keySelector] function
|
||||
* applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Sequence<T>.groupByTo(destination: M, keySelector: (T) -> K): M {
|
||||
@@ -634,7 +651,9 @@ public inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Sequence<T>.group
|
||||
* Groups values returned by the [valueTransform] function applied to each element of the original sequence
|
||||
* by the key returned by the given [keySelector] function applied to the element
|
||||
* and puts to the [destination] map each group key associated with a list of corresponding values.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Sequence<T>.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {
|
||||
@@ -734,6 +753,7 @@ public fun <T> Sequence<T>.withIndex(): Sequence<IndexedValue<T>> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing only distinct elements from the given sequence.
|
||||
*
|
||||
* The elements in the resulting sequence are in the same order as they were in the source sequence.
|
||||
*/
|
||||
public fun <T> Sequence<T>.distinct(): Sequence<T> {
|
||||
@@ -743,6 +763,7 @@ public fun <T> Sequence<T>.distinct(): Sequence<T> {
|
||||
/**
|
||||
* Returns a sequence containing only elements from the given sequence
|
||||
* having distinct keys returned by the given [selector] function.
|
||||
*
|
||||
* The elements in the resulting sequence are in the same order as they were in the source sequence.
|
||||
*/
|
||||
public fun <T, K> Sequence<T>.distinctBy(selector: (T) -> K): Sequence<T> {
|
||||
@@ -751,6 +772,7 @@ public fun <T, K> Sequence<T>.distinctBy(selector: (T) -> K): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a mutable set containing all distinct elements from the given sequence.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original sequence.
|
||||
*/
|
||||
public fun <T> Sequence<T>.toMutableSet(): MutableSet<T> {
|
||||
@@ -1023,6 +1045,7 @@ public operator fun <T> Sequence<T>.minus(element: T): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] array.
|
||||
*
|
||||
* Note that the source sequence and the array being subtracted are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1038,6 +1061,7 @@ public operator fun <T> Sequence<T>.minus(elements: Array<out T>): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] collection.
|
||||
*
|
||||
* Note that the source sequence and the collection being subtracted are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1055,6 +1079,7 @@ public operator fun <T> Sequence<T>.minus(elements: Iterable<T>): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] sequence.
|
||||
*
|
||||
* Note that the source sequence and the sequence being subtracted are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1105,6 +1130,7 @@ public operator fun <T> Sequence<T>.plus(element: T): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence and then all elements of the given [elements] array.
|
||||
*
|
||||
* Note that the source sequence and the array being added are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1114,6 +1140,7 @@ public operator fun <T> Sequence<T>.plus(elements: Array<out T>): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence and then all elements of the given [elements] collection.
|
||||
*
|
||||
* Note that the source sequence and the collection being added are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1123,6 +1150,7 @@ public operator fun <T> Sequence<T>.plus(elements: Iterable<T>): Sequence<T> {
|
||||
|
||||
/**
|
||||
* Returns a sequence containing all elements of original sequence and then all elements of the given [elements] sequence.
|
||||
*
|
||||
* Note that the source sequence and the sequence being added are iterated only when an `iterator` is requested from
|
||||
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
|
||||
*/
|
||||
@@ -1155,6 +1183,7 @@ public fun <T, R, V> Sequence<T>.zip(other: Sequence<R>, transform: (T, R) -> V)
|
||||
|
||||
/**
|
||||
* Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
|
||||
*
|
||||
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
|
||||
* elements will be appended, followed by the [truncated] string (which defaults to "...").
|
||||
*/
|
||||
@@ -1177,6 +1206,7 @@ public fun <T, A : Appendable> Sequence<T>.joinTo(buffer: A, separator: CharSequ
|
||||
|
||||
/**
|
||||
* Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
|
||||
*
|
||||
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
|
||||
* elements will be appended, followed by the [truncated] string (which defaults to "...").
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set except the given [element].
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.minus(element: T): Set<T> {
|
||||
@@ -25,6 +26,7 @@ public operator fun <T> Set<T>.minus(element: T): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set except the elements contained in the given [elements] array.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.minus(elements: Array<out T>): Set<T> {
|
||||
@@ -35,6 +37,7 @@ public operator fun <T> Set<T>.minus(elements: Array<out T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set except the elements contained in the given [elements] collection.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.minus(elements: Iterable<T>): Set<T> {
|
||||
@@ -50,6 +53,7 @@ public operator fun <T> Set<T>.minus(elements: Iterable<T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set except the elements contained in the given [elements] sequence.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.minus(elements: Sequence<T>): Set<T> {
|
||||
@@ -60,6 +64,7 @@ public operator fun <T> Set<T>.minus(elements: Sequence<T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set except the given [element].
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -69,6 +74,7 @@ public inline fun <T> Set<T>.minusElement(element: T): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set and then the given [element] if it isn't already in this set.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.plus(element: T): Set<T> {
|
||||
@@ -81,6 +87,7 @@ public operator fun <T> Set<T>.plus(element: T): Set<T> {
|
||||
/**
|
||||
* Returns a set containing all elements of the original set and the given [elements] array,
|
||||
* which aren't already in this set.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.plus(elements: Array<out T>): Set<T> {
|
||||
@@ -105,6 +112,7 @@ public operator fun <T> Set<T>.plus(elements: Iterable<T>): Set<T> {
|
||||
/**
|
||||
* Returns a set containing all elements of the original set and the given [elements] sequence,
|
||||
* which aren't already in this set.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
public operator fun <T> Set<T>.plus(elements: Sequence<T>): Set<T> {
|
||||
@@ -116,6 +124,7 @@ public operator fun <T> Set<T>.plus(elements: Sequence<T>): Set<T> {
|
||||
|
||||
/**
|
||||
* Returns a set containing all elements of the original set and then the given [element] if it isn't already in this set.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original set.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
|
||||
@@ -502,7 +502,9 @@ public inline fun String.reversed(): String {
|
||||
/**
|
||||
* Returns a [Map] containing key-value pairs provided by [transform] function
|
||||
* applied to characters of the given char sequence.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original char sequence.
|
||||
*/
|
||||
public inline fun <K, V> CharSequence.associate(transform: (Char) -> Pair<K, V>): Map<K, V> {
|
||||
@@ -514,7 +516,9 @@ public inline fun <K, V> CharSequence.associate(transform: (Char) -> Pair<K, V>)
|
||||
/**
|
||||
* Returns a [Map] containing the characters from the given char sequence indexed by the key
|
||||
* returned from [keySelector] function applied to each character.
|
||||
*
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original char sequence.
|
||||
*/
|
||||
public inline fun <K> CharSequence.associateBy(keySelector: (Char) -> K): Map<K, Char> {
|
||||
@@ -525,7 +529,9 @@ public inline fun <K> CharSequence.associateBy(keySelector: (Char) -> K): Map<K,
|
||||
|
||||
/**
|
||||
* Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to characters of the given char sequence.
|
||||
*
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the original char sequence.
|
||||
*/
|
||||
public inline fun <K, V> CharSequence.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, V> {
|
||||
@@ -538,6 +544,7 @@ public inline fun <K, V> CharSequence.associateBy(keySelector: (Char) -> K, valu
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function applied to each character of the given char sequence
|
||||
* and value is the character itself.
|
||||
*
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, M : MutableMap<in K, in Char>> CharSequence.associateByTo(destination: M, keySelector: (Char) -> K): M {
|
||||
@@ -551,6 +558,7 @@ public inline fun <K, M : MutableMap<in K, in Char>> CharSequence.associateByTo(
|
||||
* Populates and returns the [destination] mutable map with key-value pairs,
|
||||
* where key is provided by the [keySelector] function and
|
||||
* and value is provided by the [valueTransform] function applied to characters of the given char sequence.
|
||||
*
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {
|
||||
@@ -563,6 +571,7 @@ public inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateByTo(
|
||||
/**
|
||||
* Populates and returns the [destination] mutable map with key-value pairs
|
||||
* provided by [transform] function applied to each character of the given char sequence.
|
||||
*
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateTo(destination: M, transform: (Char) -> Pair<K, V>): M {
|
||||
@@ -609,6 +618,7 @@ public fun CharSequence.toMutableList(): MutableList<Char> {
|
||||
|
||||
/**
|
||||
* Returns a [Set] of all characters.
|
||||
*
|
||||
* The returned set preserves the element iteration order of the original char sequence.
|
||||
*/
|
||||
public fun CharSequence.toSet(): Set<Char> {
|
||||
@@ -648,7 +658,9 @@ public inline fun <R, C : MutableCollection<in R>> CharSequence.flatMapTo(destin
|
||||
/**
|
||||
* Groups characters of the original char sequence by the key returned by the given [keySelector] function
|
||||
* applied to each character and returns a map where each group key is associated with a list of corresponding characters.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original char sequence.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <K> CharSequence.groupBy(keySelector: (Char) -> K): Map<K, List<Char>> {
|
||||
@@ -659,7 +671,9 @@ public inline fun <K> CharSequence.groupBy(keySelector: (Char) -> K): Map<K, Lis
|
||||
* Groups values returned by the [valueTransform] function applied to each character of the original char sequence
|
||||
* by the key returned by the given [keySelector] function applied to the character
|
||||
* and returns a map where each group key is associated with a list of corresponding values.
|
||||
*
|
||||
* The returned map preserves the entry iteration order of the keys produced from the original char sequence.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <K, V> CharSequence.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, List<V>> {
|
||||
@@ -669,7 +683,9 @@ public inline fun <K, V> CharSequence.groupBy(keySelector: (Char) -> K, valueTra
|
||||
/**
|
||||
* Groups characters of the original char sequence by the key returned by the given [keySelector] function
|
||||
* applied to each character and puts to the [destination] map each group key associated with a list of corresponding characters.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupBy
|
||||
*/
|
||||
public inline fun <K, M : MutableMap<in K, MutableList<Char>>> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K): M {
|
||||
@@ -685,7 +701,9 @@ public inline fun <K, M : MutableMap<in K, MutableList<Char>>> CharSequence.grou
|
||||
* Groups values returned by the [valueTransform] function applied to each character of the original char sequence
|
||||
* by the key returned by the given [keySelector] function applied to the character
|
||||
* and puts to the [destination] map each group key associated with a list of corresponding values.
|
||||
*
|
||||
* @return The [destination] map.
|
||||
*
|
||||
* @sample test.collections.CollectionTest.groupByKeysAndValues
|
||||
*/
|
||||
public inline fun <K, V, M : MutableMap<in K, MutableList<V>>> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {
|
||||
|
||||
Reference in New Issue
Block a user