indexOfLast

fun <T> List<T>.indexOfLast(from: Int, predicate: (T) -> Boolean): Int

Finds the index of the last element in the list that matches the given predicate, starting the search from the specified from index and moving backwards.

Return

the index of the last element matching the condition, or -1 if no such element exists.

Parameters

from

the index to start searching from, moving backwards.

predicate

the condition to match elements against.

Throws

if from is out of bounds of the list.