kmongo / kotlin.collections / com.mongodb.client.MongoIterable / lastOrNull

lastOrNull

fun <T> MongoIterable<T>.lastOrNull(): T? (source)

Returns the last element, or null if the collection is empty.

inline fun <T> MongoIterable<T>.lastOrNull(crossinline predicate: (T) -> Boolean): T? (source)

Returns the last element matching the given predicate, or null if no such element was found.