Kotlin HashSet last()
Syntax & Examples


Syntax of HashSet.last()

There are 2 variations for the syntax of HashSet.last() extension function. They are:

1.
fun <T> Iterable<T>.last(): T

This extension function returns the last element.

2.
fun <T> Iterable<T>.last(predicate: (T) -> Boolean): T

This extension function returns the last element matching the given predicate.