diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index ddff9db3da7..760c55f9219 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -2,8 +2,8 @@ package dev.inmo.micro_utils.common inline fun Iterable.joinTo( crossinline separatorFun: (I) -> R?, - prefix: R?, - postfix: R?, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): List { val result = mutableListOf() @@ -26,12 +26,26 @@ inline fun Iterable.joinTo( } inline fun Iterable.joinTo( - separator: R?, - prefix: R?, - postfix: R?, + separator: R? = null, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): List = joinTo({ separator }, prefix, postfix, transform) +inline fun Iterable.joinTo( + crossinline separatorFun: (I) -> I?, + prefix: I? = null, + postfix: I? = null, + crossinline transform: (I) -> I? +): List = joinTo(separatorFun, prefix, postfix, transform) + +inline fun Iterable.joinTo( + separator: I?, + prefix: I? = null, + postfix: I? = null, + crossinline transform: (I) -> I? +): List = joinTo({ separator }, prefix, postfix, transform) + inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, prefix: R?, @@ -40,8 +54,8 @@ inline fun Array.joinTo( ): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray() inline fun Array.joinTo( - separator: R?, - prefix: R?, - postfix: R?, + separator: R? = null, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): Array = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray()