public inline fun <T> List<T>.indexOfFirst(predicate: (T) -> Boolean): Int {
var index = 0
for (item in this) {
if (predicate(item))
return index
index++
}
return -1
}
val list = listOf(1, 2, 3, 4, 5)
println(list.indexOfFirst{ it > 3 }) // 3
println(list.indexOfFirst{ it > 7 }) // -1