Add samples for joinTo

KT-20357
This commit is contained in:
gzoritchak
2018-02-11 15:25:35 +01:00
committed by ilya-g
parent 40e3159463
commit f790635b30
11 changed files with 79 additions and 36 deletions
@@ -7232,6 +7232,8 @@ public expect inline fun <V> 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 <T, A : Appendable> Array<out T>.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 <T, A : Appendable> Array<out T>.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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> 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 <A : Appendable> CharArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((Char) -> CharSequence)? = null): A {
buffer.append(prefix)
@@ -1135,6 +1135,8 @@ public expect inline fun <T, R> Iterable<T>.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 <T, A : Appendable> Iterable<T>.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A {
buffer.append(prefix)
@@ -1023,6 +1023,8 @@ public expect fun <T, R> Sequence<T>.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_.
*/