single Or Null
Returns single element, or null
if the array is empty or has more than one element.
inline fun ShortArray.singleOrNull(predicate: (Short) -> Boolean): Short?
Content copied to clipboard
inline fun FloatArray.singleOrNull(predicate: (Float) -> Boolean): Float?
Content copied to clipboard
inline fun DoubleArray.singleOrNull(predicate: (Double) -> Boolean): Double?
Content copied to clipboard
inline fun BooleanArray.singleOrNull(predicate: (Boolean) -> Boolean): Boolean?
Content copied to clipboard
Returns the single element matching the given predicate, or null
if element was not found or more than one element was found.
Returns single element, or null
if the collection is empty or has more than one element.
Returns single element, or null
if the list is empty or has more than one element.
Returns single element, or null
if the array is empty or has more than one element.
Since Kotlin
1.3
inline fun ULongArray.singleOrNull(predicate: (ULong) -> Boolean): ULong?
Content copied to clipboard
inline fun UByteArray.singleOrNull(predicate: (UByte) -> Boolean): UByte?
Content copied to clipboard
inline fun UShortArray.singleOrNull(predicate: (UShort) -> Boolean): UShort?
Content copied to clipboard
Returns the single element matching the given predicate, or null
if element was not found or more than one element was found.
Since Kotlin
1.3