filterNot

inline fun <T> Array<out T>.filterNot(
    predicate: (T) -> Boolean
): List<T>
(source)
inline fun ByteArray.filterNot(
    predicate: (Byte) -> Boolean
): List<Byte>
(source)
inline fun ShortArray.filterNot(
    predicate: (Short) -> Boolean
): List<Short>
(source)
inline fun IntArray.filterNot(
    predicate: (Int) -> Boolean
): List<Int>
(source)
inline fun LongArray.filterNot(
    predicate: (Long) -> Boolean
): List<Long>
(source)
inline fun FloatArray.filterNot(
    predicate: (Float) -> Boolean
): List<Float>
(source)
inline fun DoubleArray.filterNot(
    predicate: (Double) -> Boolean
): List<Double>
(source)
inline fun BooleanArray.filterNot(
    predicate: (Boolean) -> Boolean
): List<Boolean>
(source)
inline fun CharArray.filterNot(
    predicate: (Char) -> Boolean
): List<Char>
(source)
inline fun <T> Iterable<T>.filterNot(
    predicate: (T) -> Boolean
): List<T>
(source)

Returns a list containing all elements not matching the given predicate.

inline fun <K, V> Map<out K, V>.filterNot(
    predicate: (Entry<K, V>) -> Boolean
): Map<K, V>
(source)

Returns a new map containing all key-value pairs not matching the given predicate.

The returned map preserves the entry iteration order of the original map.

import kotlin.test.*
import java.util.*

fun main(args: Array<String>) {
//sampleStart
val originalMap = mapOf("key1" to 1, "key2" to 2, "key3" to 3)

val filteredMap = originalMap.filterNot { it.value < 3 }
println(filteredMap) // {key3=3}
// original map has not changed
println(originalMap) // {key1=1, key2=2, key3=3}

val matchAllPredicate: ((Map.Entry<String, Int>)) -> Boolean = { it.value > 0 }
val emptyMap = originalMap.filterNot(matchAllPredicate)
println(emptyMap) // {}
//sampleEnd
}