single
fun ByteArray.single(): Bytefun ShortArray.single(): Shortfun IntArray.single(): Intfun LongArray.single(): Longfun FloatArray.single(): Floatfun DoubleArray.single(): Doublefun BooleanArray.single(): Booleanfun CharArray.single(): Char@ExperimentalUnsignedTypes fun ULongArray.single(): ULong@ExperimentalUnsignedTypes fun UByteArray.single(): UByte@ExperimentalUnsignedTypes fun UShortArray.single(): UShortReturns the single element, or throws an exception if the array is empty or has more than one element.
inline fun ByteArray.single(
predicate: (Byte) -> Boolean
): Byteinline fun ShortArray.single(
predicate: (Short) -> Boolean
): Shortinline fun IntArray.single(predicate: (Int) -> Boolean): Intinline fun LongArray.single(
predicate: (Long) -> Boolean
): Longinline fun FloatArray.single(
predicate: (Float) -> Boolean
): Floatinline fun DoubleArray.single(
predicate: (Double) -> Boolean
): Doubleinline fun BooleanArray.single(
predicate: (Boolean) -> Boolean
): Booleaninline fun CharArray.single(
predicate: (Char) -> Boolean
): Charinline fun <T> Iterable<T>.single(
predicate: (T) -> Boolean
): T@ExperimentalUnsignedTypes inline fun ULongArray.single(
predicate: (ULong) -> Boolean
): ULong@ExperimentalUnsignedTypes inline fun UByteArray.single(
predicate: (UByte) -> Boolean
): UByte@ExperimentalUnsignedTypes inline fun UShortArray.single(
predicate: (UShort) -> Boolean
): UShortReturns the single element matching the given predicate, or throws exception if there is no or more than one matching element.
fun <T> Iterable<T>.single(): TReturns the single element, or throws an exception if the collection is empty or has more than one element.
fun <T> List<T>.single(): TReturns the single element, or throws an exception if the list is empty or has more than one element.