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

fold

fun <T, K, R> Field<Grouping<T, K>>.fold(initialValue: R, operation: (accumulator: R, element: T) -> R): Field<Map<K, R>>
fun <T, K, R> Field<Grouping<T, K>>.fold(initialValue: Field<R>, operation: (accumulator: R, element: T) -> R): Field<Map<K, R>>
fun <T, K, R> Field<Grouping<T, K>>.fold(initialValueSelector: (key: K, element: T) -> R, operation: (key: K, accumulator: R, element: T) -> R): Field<Map<K, R>>
fun <T, R> Field<Iterable<T>>.fold(initial: R, operation: (acc: R, T) -> R): Field<R>
fun <T, R> Field<Iterable<T>>.fold(initial: Field<R>, operation: (acc: R, T) -> R): Field<R>

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

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

This is simply a convenience function.

See Also

kotlin.collections.fold


fun <T, R> Field<Sequence<T>>.fold(initial: R, operation: (acc: R, T) -> R): Field<R>
fun <T, R> Field<Sequence<T>>.fold(initial: Field<R>, operation: (acc: R, T) -> R): Field<R>

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

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

This is simply a convenience function.

See Also

kotlin.sequences.fold


fun <R> Field<String>.fold(initial: R, operation: (acc: R, Char) -> R): Field<R>
fun <R> Field<String>.fold(initial: Field<R>, operation: (acc: R, Char) -> R): Field<R>

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

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

This is simply a convenience function.

See Also

kotlin.text.fold