@NonNull static fun <A : Any!> conditionalMap(@NonNull list: MutableList<A>, @NonNull predicate: Predicate<A>, @NonNull mapper: (A) -> A): MutableList<A>
Performs a conditional map on the given list. Runs a given mapper function for every list element that satisfies the given predicate. Values that do not satisfy the predicate are returned without any change.
list
- MutableList<A>: list of values that should be conditionally mapped
predicate
- Predicate<A>: predicate that needs to be satisfied
mapper
- (A) -> A: function that will be run for each element that satisfies the predicate
Return
MutableList<A>: list of mapped elements.