Documentation / dataflow / com.femastudios.dataflow.extensions / elementAtOrElse
Go to reference

elementAtOrElse

fun <T> Field<Iterable<T>>.elementAtOrElse(index: Field<Int>, defaultValue: (Int) -> T): Field<T>
fun <T> Field<Iterable<T>>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): Field<T>
fun <T> Field<List<T>>.elementAtOrElse(index: Field<Int>, defaultValue: (Int) -> T): Field<T>
fun <T> Field<List<T>>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): Field<T>

Same as elementAtOrElse, but accepts Field and returns a new Field.

Calling this function is equivalent to use transform and calling elementAtOrElse in the transformation function.

This is simply a convenience function.

See Also

kotlin.collections.elementAtOrElse


fun <T> Field<Sequence<T>>.elementAtOrElse(index: Field<Int>, defaultValue: (Int) -> T): Field<T>
fun <T> Field<Sequence<T>>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): Field<T>

Same as elementAtOrElse, but accepts Field and returns a new Field.

Calling this function is equivalent to use transform and calling elementAtOrElse in the transformation function.

This is simply a convenience function.

See Also

kotlin.sequences.elementAtOrElse


fun Field<String>.elementAtOrElse(index: Field<Int>, defaultValue: (Int) -> Char): Field<Char>
fun Field<String>.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Field<Char>

Same as elementAtOrElse, but accepts Field and returns a new Field.

Calling this function is equivalent to use transform and calling elementAtOrElse in the transformation function.

This is simply a convenience function.

See Also

kotlin.text.elementAtOrElse