We break down how to read Kotlin function types of the form
(A)
->
B, what a predicate
(T)
->
Boolean is, why higher-order functions are needed, and how to stop copying loops by passing “behavior” as a parameter. In practice, we will write our own versions of
countMatching,
forEachIf, and
findFirstOrNull and apply them to a mini expense-tracking project on
MutableList with a
Triple model.