none

Common
JVM
JS
Native
1.0
fun <T> Array<out T>.none(): Boolean
(source)
fun ByteArray.none(): Boolean
(source)
fun ShortArray.none(): Boolean
(source)
fun IntArray.none(): Boolean
(source)
fun LongArray.none(): Boolean
(source)
fun FloatArray.none(): Boolean
(source)
fun DoubleArray.none(): Boolean
(source)
fun BooleanArray.none(): Boolean
(source)
fun CharArray.none(): Boolean
(source)
@ExperimentalUnsignedTypes fun UIntArray.none(): Boolean
(source)
@ExperimentalUnsignedTypes fun ULongArray.none(): Boolean
(source)
@ExperimentalUnsignedTypes fun UByteArray.none(): Boolean
(source)
@ExperimentalUnsignedTypes fun UShortArray.none(): Boolean
(source)

Returns true if the array has no elements.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val emptyList = emptyList<Int>()
println("emptyList.none() is ${emptyList.none()}") // true

val nonEmptyList = listOf("one", "two", "three")
println("nonEmptyList.none() is ${nonEmptyList.none()}") // false
//sampleEnd
}
Common
JVM
JS
Native
1.0
inline fun <T> Array<out T>.none(
    predicate: (T) -> Boolean
): Boolean

(source)
inline fun ByteArray.none(
    predicate: (Byte) -> Boolean
): Boolean

(source)
inline fun ShortArray.none(
    predicate: (Short) -> Boolean
): Boolean

(source)
inline fun IntArray.none(
    predicate: (Int) -> Boolean
): Boolean

(source)
inline fun LongArray.none(
    predicate: (Long) -> Boolean
): Boolean

(source)
inline fun FloatArray.none(
    predicate: (Float) -> Boolean
): Boolean

(source)
inline fun DoubleArray.none(
    predicate: (Double) -> Boolean
): Boolean

(source)
inline fun BooleanArray.none(
    predicate: (Boolean) -> Boolean
): Boolean

(source)
inline fun CharArray.none(
    predicate: (Char) -> Boolean
): Boolean

(source)
inline fun <T> Iterable<T>.none(
    predicate: (T) -> Boolean
): Boolean

(source)
@ExperimentalUnsignedTypes inline fun UIntArray.none(
    predicate: (UInt) -> Boolean
): Boolean

(source)
@ExperimentalUnsignedTypes inline fun ULongArray.none(
    predicate: (ULong) -> Boolean
): Boolean

(source)
@ExperimentalUnsignedTypes inline fun UByteArray.none(
    predicate: (UByte) -> Boolean
): Boolean

(source)
@ExperimentalUnsignedTypes inline fun UShortArray.none(
    predicate: (UShort) -> Boolean
): Boolean

(source)

Returns true if no elements match the given predicate.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val isEven: (Int) -> Boolean = { it % 2 == 0 }
val zeroToTen = 0..10
println("zeroToTen.none { isEven(it) } is ${zeroToTen.none { isEven(it) }}") // false
println("zeroToTen.none(isEven) is ${zeroToTen.none(isEven)}") // false

val odds = zeroToTen.map { it * 2 + 1 }
println("odds.none { isEven(it) } is ${odds.none { isEven(it) }}") // true

val emptyList = emptyList<Int>()
println("emptyList.none { true } is ${emptyList.none { true }}") // true
//sampleEnd
}
Common
JVM
JS
Native
1.0
fun <T> Iterable<T>.none(): Boolean
(source)

Returns true if the collection has no elements.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val emptyList = emptyList<Int>()
println("emptyList.none() is ${emptyList.none()}") // true

val nonEmptyList = listOf("one", "two", "three")
println("nonEmptyList.none() is ${nonEmptyList.none()}") // false
//sampleEnd
}
Common
JVM
JS
Native
1.0
fun <K, V> Map<out K, V>.none(): Boolean
(source)

Returns true if the map has no entries.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val emptyList = emptyList<Int>()
println("emptyList.none() is ${emptyList.none()}") // true

val nonEmptyList = listOf("one", "two", "three")
println("nonEmptyList.none() is ${nonEmptyList.none()}") // false
//sampleEnd
}
Common
JVM
JS
Native
1.0
inline fun <K, V> Map<out K, V>.none(
    predicate: (Entry<K, V>) -> Boolean
): Boolean

(source)

Returns true if no entries match the given predicate.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val isEven: (Int) -> Boolean = { it % 2 == 0 }
val zeroToTen = 0..10
println("zeroToTen.none { isEven(it) } is ${zeroToTen.none { isEven(it) }}") // false
println("zeroToTen.none(isEven) is ${zeroToTen.none(isEven)}") // false

val odds = zeroToTen.map { it * 2 + 1 }
println("odds.none { isEven(it) } is ${odds.none { isEven(it) }}") // true

val emptyList = emptyList<Int>()
println("emptyList.none { true } is ${emptyList.none { true }}") // true
//sampleEnd
}