Kotlin HashSet ifEmpty()
Syntax & Examples
Syntax of HashSet.ifEmpty()
The syntax of HashSet.ifEmpty() extension function is:
fun <C, R> C.ifEmpty( defaultValue: () -> R ): R where C : Array<*>, C : R
This ifEmpty() extension function of HashSet returns this array if it's not empty or the result of calling defaultValue function if the array is empty.