contains All
inline fun <T> Collection<T>.containsAll(elements: Collection<T>): Boolean
Content copied to clipboard
Checks if all elements in the specified collection are contained in this collection.
Allows to overcome type-safety restriction of containsAll
that requires to pass a collection of type Collection<E>
.
Samples
import samples.*
import kotlin.test.*
fun main() {
//sampleStart
val collection = mutableListOf('a', 'b')
val test = listOf('a', 'b', 'c')
assertFalse(collection.containsAll(test))
collection.add('c')
assertTrue(collection.containsAll(test))
//sampleEnd
}