doc / ch.tutteli.atrium.logic.utils / mapArguments

mapArguments

fun <T> mapArguments(first: T, others: Array<out T>): ArgumentMapperBuilder<T>

Creates a ArgumentMapperBuilder with the given first and others as arguments; specify the mapping as such using a subsequent step in the building process.

For instance (there are more options as second step to choose from):

fun <K, V> pairs(pair: Pair<K, V>, vararg otherPairs: Pair<K, V>) {
  mapArguments(pair, otherPairs).toExpect<Map.Entry<K, V>> { isKeyValue(it) }
}
inline fun <T, reified R> mapArguments(first: T, others: Array<out T>, mapper: (T) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Byte, others: ByteArray, mapper: (Byte) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Char, others: CharArray, mapper: (Char) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Short, others: ShortArray, mapper: (Short) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Int, others: IntArray, mapper: (Int) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Long, others: LongArray, mapper: (Long) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Float, others: FloatArray, mapper: (Float) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Double, others: DoubleArray, mapper: (Double) -> R): Pair<R, Array<out R>>
inline fun <reified R> mapArguments(first: Boolean, others: BooleanArray, mapper: (Boolean) -> R): Pair<R, Array<out R>>

Maps the given first and others to the given type R with the help of the given mapper.

Use the overload without mapper in case you want to map to an lambda with an Expect receiver and use one of the available options as second step. For instance, mapArguments(a, aX).toExpect<String> { ... }

fun mapArguments(first: Byte, others: ByteArray): ArgumentMapperBuilder<Byte>
fun mapArguments(first: Char, others: CharArray): ArgumentMapperBuilder<Char>
fun mapArguments(first: Short, others: ShortArray): ArgumentMapperBuilder<Short>
fun mapArguments(first: Int, others: IntArray): ArgumentMapperBuilder<Int>
fun mapArguments(first: Long, others: LongArray): ArgumentMapperBuilder<Long>
fun mapArguments(first: Float, others: FloatArray): ArgumentMapperBuilder<Float>
fun mapArguments(first: Double, others: DoubleArray): ArgumentMapperBuilder<Double>
fun mapArguments(first: Boolean, others: BooleanArray): ArgumentMapperBuilder<Boolean>

Creates a ArgumentMapperBuilder with the given first and others as arguments; specify the mapping as such using a subsequent step in the building process.