kotlin.collections.single

single

fun <T> Iterable<T>.single(): T

Returns the single element, or throws an exception if the collection is empty or has more than one element.

fun <T> List<T>.single(): T

Returns the single element, or throws an exception if the list is empty or has more than one element.

inline fun <T> Iterable<T>.single(
    predicate: (T) -> Boolean
): T
inline fun <T> Array<out T>.single(