diff --git a/js/js.libraries/src/core/generated/_ArraysJs.kt b/js/js.libraries/src/core/generated/_ArraysJs.kt index 50c726dc3f0..8a38b6fb6e8 100644 --- a/js/js.libraries/src/core/generated/_ArraysJs.kt +++ b/js/js.libraries/src/core/generated/_ArraysJs.kt @@ -12862,6 +12862,8 @@ public inline fun CharArray.zip(other: CharArray, transform: (a: Char, b: Ch * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Array.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12882,6 +12884,8 @@ public fun Array.joinTo(buffer: A, separator: CharSeq * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ByteArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Byte) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12905,6 +12909,8 @@ public fun ByteArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ShortArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Short) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12928,6 +12934,8 @@ public fun ShortArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun IntArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Int) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12951,6 +12959,8 @@ public fun IntArray.joinTo(buffer: A, separator: CharSequence = * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun LongArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Long) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12974,6 +12984,8 @@ public fun LongArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun FloatArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Float) -> CharSequence)? = null): A { buffer.append(prefix) @@ -12997,6 +13009,8 @@ public fun FloatArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun DoubleArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Double) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13020,6 +13034,8 @@ public fun DoubleArray.joinTo(buffer: A, separator: CharSequenc * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun BooleanArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Boolean) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13043,6 +13059,8 @@ public fun BooleanArray.joinTo(buffer: A, separator: CharSequen * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun CharArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Char) -> CharSequence)? = null): A { buffer.append(prefix) diff --git a/js/js.libraries/src/core/generated/_CollectionsJs.kt b/js/js.libraries/src/core/generated/_CollectionsJs.kt index 57de8cb46ab..4735d194b34 100644 --- a/js/js.libraries/src/core/generated/_CollectionsJs.kt +++ b/js/js.libraries/src/core/generated/_CollectionsJs.kt @@ -2147,6 +2147,8 @@ public inline fun Iterable.zipWithNext(transform: (a: T, b: T) -> R): * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Iterable.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) diff --git a/js/js.libraries/src/core/generated/_SequencesJs.kt b/js/js.libraries/src/core/generated/_SequencesJs.kt index c9deea36152..34a1b0a7d97 100644 --- a/js/js.libraries/src/core/generated/_SequencesJs.kt +++ b/js/js.libraries/src/core/generated/_SequencesJs.kt @@ -1607,6 +1607,8 @@ public fun Sequence.zipWithNext(transform: (a: T, b: T) -> R): Sequenc * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo * * The operation is _terminal_. */ diff --git a/libraries/stdlib/common/src/generated/_Arrays.kt b/libraries/stdlib/common/src/generated/_Arrays.kt index 6576be00200..029f5cf838e 100644 --- a/libraries/stdlib/common/src/generated/_Arrays.kt +++ b/libraries/stdlib/common/src/generated/_Arrays.kt @@ -7232,6 +7232,8 @@ public expect inline fun CharArray.zip(other: CharArray, transform: (a: Char * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Array.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7252,6 +7254,8 @@ public fun Array.joinTo(buffer: A, separator: CharSeq * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ByteArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Byte) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7275,6 +7279,8 @@ public fun ByteArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ShortArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Short) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7298,6 +7304,8 @@ public fun ShortArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun IntArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Int) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7321,6 +7329,8 @@ public fun IntArray.joinTo(buffer: A, separator: CharSequence = * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun LongArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Long) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7344,6 +7354,8 @@ public fun LongArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun FloatArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Float) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7367,6 +7379,8 @@ public fun FloatArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun DoubleArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Double) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7390,6 +7404,8 @@ public fun DoubleArray.joinTo(buffer: A, separator: CharSequenc * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun BooleanArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Boolean) -> CharSequence)? = null): A { buffer.append(prefix) @@ -7413,6 +7429,8 @@ public fun BooleanArray.joinTo(buffer: A, separator: CharSequen * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun CharArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Char) -> CharSequence)? = null): A { buffer.append(prefix) diff --git a/libraries/stdlib/common/src/generated/_Collections.kt b/libraries/stdlib/common/src/generated/_Collections.kt index fd5984d72d3..a9ce9316346 100644 --- a/libraries/stdlib/common/src/generated/_Collections.kt +++ b/libraries/stdlib/common/src/generated/_Collections.kt @@ -1135,6 +1135,8 @@ public expect inline fun Iterable.zipWithNext(transform: (a: T, b: T) * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Iterable.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) diff --git a/libraries/stdlib/common/src/generated/_Sequences.kt b/libraries/stdlib/common/src/generated/_Sequences.kt index ad48b96b77f..d2c15dd0d81 100644 --- a/libraries/stdlib/common/src/generated/_Sequences.kt +++ b/libraries/stdlib/common/src/generated/_Sequences.kt @@ -1023,6 +1023,8 @@ public expect fun Sequence.zipWithNext(transform: (a: T, b: T) -> R): * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo * * The operation is _terminal_. */ diff --git a/libraries/stdlib/samples/test/samples/collections/collections.kt b/libraries/stdlib/samples/test/samples/collections/collections.kt index 1c8a766790f..e612a146322 100644 --- a/libraries/stdlib/samples/test/samples/collections/collections.kt +++ b/libraries/stdlib/samples/test/samples/collections/collections.kt @@ -311,6 +311,17 @@ class Collections { assertPrints(moreFrequencies, "{o=1, t=4, f=2, s=2, e=2, n=1}") } + @Sample + fun joinTo() { + val sb = StringBuilder("An existing string and a list: ") + val numbers = listOf(1, 2, 3) + assertPrints(numbers.joinTo(sb, prefix = "[", postfix = "]").toString(), "An existing string and a list: [1, 2, 3]") + + val lotOfNumbers: Iterable = 1..100 + val firstNumbers = StringBuilder("First five numbers: ") + assertPrints(lotOfNumbers.joinTo(firstNumbers, limit = 5).toString(), "First five numbers: 1, 2, 3, 4, 5, ...") + } + @Sample fun joinToString() { val numbers = listOf(1, 2, 3, 4, 5, 6) diff --git a/libraries/stdlib/src/generated/_Arrays.kt b/libraries/stdlib/src/generated/_Arrays.kt index 6769c8edca9..2e0f295d109 100644 --- a/libraries/stdlib/src/generated/_Arrays.kt +++ b/libraries/stdlib/src/generated/_Arrays.kt @@ -13298,6 +13298,8 @@ public inline fun CharArray.zip(other: CharArray, transform: (a: Char, b: Ch * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Array.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13318,6 +13320,8 @@ public fun Array.joinTo(buffer: A, separator: CharSeq * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ByteArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Byte) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13341,6 +13345,8 @@ public fun ByteArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun ShortArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Short) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13364,6 +13370,8 @@ public fun ShortArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun IntArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Int) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13387,6 +13395,8 @@ public fun IntArray.joinTo(buffer: A, separator: CharSequence = * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun LongArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Long) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13410,6 +13420,8 @@ public fun LongArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun FloatArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Float) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13433,6 +13445,8 @@ public fun FloatArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun DoubleArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Double) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13456,6 +13470,8 @@ public fun DoubleArray.joinTo(buffer: A, separator: CharSequenc * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun BooleanArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Boolean) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13479,6 +13495,8 @@ public fun BooleanArray.joinTo(buffer: A, separator: CharSequen * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun CharArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Char) -> CharSequence)? = null): A { buffer.append(prefix) @@ -13502,11 +13520,7 @@ public fun CharArray.joinTo(buffer: A, separator: CharSequence * * 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 "..."). -<<<<<<< HEAD * -======= - * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun Array.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String { @@ -13518,11 +13532,7 @@ public fun Array.joinToString(separator: CharSequence = ", ", prefix: * * 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 "..."). -<<<<<<< HEAD * -======= - * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun ByteArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Byte) -> CharSequence)? = null): String { @@ -13534,11 +13544,7 @@ public fun ByteArray.joinToString(separator: CharSequence = ", ", prefix: CharSe * * 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 "..."). -<<<<<<< HEAD - * -======= * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun ShortArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Short) -> CharSequence)? = null): String { @@ -13550,11 +13556,7 @@ public fun ShortArray.joinToString(separator: CharSequence = ", ", prefix: CharS * * 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 "..."). -<<<<<<< HEAD * -======= - * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun IntArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Int) -> CharSequence)? = null): String { @@ -13566,11 +13568,7 @@ public fun IntArray.joinToString(separator: CharSequence = ", ", prefix: CharSeq * * 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 "..."). -<<<<<<< HEAD - * -======= * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun LongArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Long) -> CharSequence)? = null): String { @@ -13582,11 +13580,7 @@ public fun LongArray.joinToString(separator: CharSequence = ", ", prefix: CharSe * * 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 "..."). -<<<<<<< HEAD - * -======= * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun FloatArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Float) -> CharSequence)? = null): String { @@ -13598,11 +13592,7 @@ public fun FloatArray.joinToString(separator: CharSequence = ", ", prefix: CharS * * 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 "..."). -<<<<<<< HEAD - * -======= * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun DoubleArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Double) -> CharSequence)? = null): String { @@ -13614,11 +13604,7 @@ public fun DoubleArray.joinToString(separator: CharSequence = ", ", prefix: Char * * 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 "..."). -<<<<<<< HEAD - * -======= * ->>>>>>> b371fcfd5d9... Add samples for joinToString * @sample samples.collections.Collections.Transformations.joinToString */ public fun BooleanArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Boolean) -> CharSequence)? = null): String { diff --git a/libraries/stdlib/src/generated/_Collections.kt b/libraries/stdlib/src/generated/_Collections.kt index 3b3e6b1d79f..9b1d05f8cac 100644 --- a/libraries/stdlib/src/generated/_Collections.kt +++ b/libraries/stdlib/src/generated/_Collections.kt @@ -2171,6 +2171,8 @@ public inline fun Iterable.zipWithNext(transform: (a: T, b: T) -> R): * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo */ public fun Iterable.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { buffer.append(prefix) @@ -2191,8 +2193,6 @@ public fun Iterable.joinTo(buffer: A, separator: CharSequ * * 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 "..."). - * - * @sample samples.collections.Collections.Transformations.joinToString */ public fun Iterable.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String { return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString() diff --git a/libraries/stdlib/src/generated/_Sequences.kt b/libraries/stdlib/src/generated/_Sequences.kt index 02307026566..915ec148d96 100644 --- a/libraries/stdlib/src/generated/_Sequences.kt +++ b/libraries/stdlib/src/generated/_Sequences.kt @@ -1648,6 +1648,8 @@ public fun Sequence.zipWithNext(transform: (a: T, b: T) -> R): Sequenc * * 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 "..."). + * + * @sample samples.collections.Collections.Transformations.joinTo * * The operation is _terminal_. */ @@ -1674,8 +1676,6 @@ public fun Sequence.joinTo(buffer: A, separator: CharSequ * @sample samples.collections.Collections.Transformations.joinToString * * The operation is _terminal_. - * - * @sample samples.collections.Collections.Transformations.joinToString */ public fun Sequence.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String { return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString() diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Strings.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Strings.kt index f0138afa2c1..74b2e06737c 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Strings.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Strings.kt @@ -30,6 +30,8 @@ object StringJoinOps : TemplateGroupBase() { 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 "..."). + + @sample samples.collections.Collections.Transformations.joinTo """ } sequenceClassification(terminal)