to

open fun to(consumer: Consumer<T>)

Complete the mapping by passing any non-filtered value to the specified consumer. The method is designed to be used with mutable objects.

Parameters

consumer

the consumer that should accept the value if it's not beenfiltered


open fun <R> to(instance: R, mapper: BiFunction<R, T, R>): R

Complete the mapping for any non-filtered value by applying the given function to an existing instance and returning a new one. For filtered values, the instance parameter is returned unchanged. The method is designed to be used with immutable objects.

Return

a new mapped instance or the original instance

Since

3.0.0

Parameters

<R>

the result type

instance

the current instance

mapper

the mapping function