mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-17 22:03:50 +00:00
small addition to joinTo
This commit is contained in:
parent
97fc1d6239
commit
3dc68a7b8b
@ -2,8 +2,8 @@ package dev.inmo.micro_utils.common
|
|||||||
|
|
||||||
inline fun <I, R> Iterable<I>.joinTo(
|
inline fun <I, R> Iterable<I>.joinTo(
|
||||||
crossinline separatorFun: (I) -> R?,
|
crossinline separatorFun: (I) -> R?,
|
||||||
prefix: R?,
|
prefix: R? = null,
|
||||||
postfix: R?,
|
postfix: R? = null,
|
||||||
crossinline transform: (I) -> R?
|
crossinline transform: (I) -> R?
|
||||||
): List<R> {
|
): List<R> {
|
||||||
val result = mutableListOf<R>()
|
val result = mutableListOf<R>()
|
||||||
@ -26,12 +26,26 @@ inline fun <I, R> Iterable<I>.joinTo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline fun <I, R> Iterable<I>.joinTo(
|
inline fun <I, R> Iterable<I>.joinTo(
|
||||||
separator: R?,
|
separator: R? = null,
|
||||||
prefix: R?,
|
prefix: R? = null,
|
||||||
postfix: R?,
|
postfix: R? = null,
|
||||||
crossinline transform: (I) -> R?
|
crossinline transform: (I) -> R?
|
||||||
): List<R> = joinTo({ separator }, prefix, postfix, transform)
|
): List<R> = joinTo({ separator }, prefix, postfix, transform)
|
||||||
|
|
||||||
|
inline fun <I> Iterable<I>.joinTo(
|
||||||
|
crossinline separatorFun: (I) -> I?,
|
||||||
|
prefix: I? = null,
|
||||||
|
postfix: I? = null,
|
||||||
|
crossinline transform: (I) -> I?
|
||||||
|
): List<I> = joinTo<I, I>(separatorFun, prefix, postfix, transform)
|
||||||
|
|
||||||
|
inline fun <I> Iterable<I>.joinTo(
|
||||||
|
separator: I?,
|
||||||
|
prefix: I? = null,
|
||||||
|
postfix: I? = null,
|
||||||
|
crossinline transform: (I) -> I?
|
||||||
|
): List<I> = joinTo<I>({ separator }, prefix, postfix, transform)
|
||||||
|
|
||||||
inline fun <I, reified R> Array<I>.joinTo(
|
inline fun <I, reified R> Array<I>.joinTo(
|
||||||
crossinline separatorFun: (I) -> R?,
|
crossinline separatorFun: (I) -> R?,
|
||||||
prefix: R?,
|
prefix: R?,
|
||||||
@ -40,8 +54,8 @@ inline fun <I, reified R> Array<I>.joinTo(
|
|||||||
): Array<R> = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray()
|
): Array<R> = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray()
|
||||||
|
|
||||||
inline fun <I, reified R> Array<I>.joinTo(
|
inline fun <I, reified R> Array<I>.joinTo(
|
||||||
separator: R?,
|
separator: R? = null,
|
||||||
prefix: R?,
|
prefix: R? = null,
|
||||||
postfix: R?,
|
postfix: R? = null,
|
||||||
crossinline transform: (I) -> R?
|
crossinline transform: (I) -> R?
|
||||||
): Array<R> = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray()
|
): Array<R> = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray()
|
||||||
|
Loading…
Reference in New Issue
Block a user