Add Collections.isNullOrEmpty #KT-23279
This commit is contained in:
committed by
Ilya Gorbunov
parent
6a140fb9ed
commit
292f69936b
@@ -51,6 +51,18 @@ class Collections {
|
||||
assertPrints(collection.orEmpty(), "[a, b, c]")
|
||||
}
|
||||
|
||||
@Sample
|
||||
fun collectionIsNullOrEmpty() {
|
||||
val nullCollection: Collection<Any>? = null
|
||||
assertTrue(nullCollection.isNullOrEmpty())
|
||||
|
||||
val emptyCollection: Collection<Any>? = listOf()
|
||||
assertTrue(emptyCollection.isNullOrEmpty())
|
||||
|
||||
val collection: Collection<Char>? = listOf('a', 'b', 'c')
|
||||
assertFalse(collection.isNullOrEmpty())
|
||||
}
|
||||
|
||||
@Sample
|
||||
fun collectionContainsAll() {
|
||||
val collection = mutableListOf('a', 'b')
|
||||
|
||||
Reference in New Issue
Block a user