arrow-core-data / arrow.core / ListK / padZipWithNull

padZipWithNull

fun <B> padZipWithNull(other: ListK<B>): ListK<Tuple2<A?, B?>>

Returns a ListKTuple2A?,B? containing the zipped values of the two listKs with null for padding.

Example:

import arrow.core.*

//sampleStart
val padRight = listOf(1, 2).k().padZip(listOf("a").k())        // Result: ListK(Tuple2(1, "a"), Tuple2(2, null))
val padLeft = listOf(1).k().padZip(listOf("a", "b").k())       // Result: ListK(Tuple2(1, "a"), Tuple2(null, "b"))
val noPadding = listOf(1, 2).k().padZip(listOf("a", "b").k())  // Result: ListK(Tuple2(1, "a"), Tuple2(2, "b"))
//sampleEnd

fun main() {
  println("padRight = $padRight")
  println("padLeft = $padLeft")
  println("noPadding = $noPadding")
}

Do you like Arrow?

Arrow Org
<