Add sample for emptySet

This commit is contained in:
Andre Perkins
2018-01-06 19:04:55 -05:00
committed by Ilya Gorbunov
parent 11696ac4c0
commit 31d650a041
2 changed files with 24 additions and 2 deletions
@@ -257,6 +257,22 @@ class Collections {
}
}
class Sets {
@Sample
fun emptyReadOnlySet() {
val set = setOf<String>()
assertTrue(set.isEmpty())
// another way to create an empty set,
// type parameter is inferred from the expected type
val other: Set<Int> = emptySet()
assertTrue(set == other, "Empty sets are equal")
assertPrints(set, "[]")
}
}
class Transformations {
@Sample