NotEmptySet
Represents a set that has at least one element of type E.
You can use the notEmptySetOf or the toNotEmptySet functions for creating an instance of this type.
Serialization and deserialization
The serialization and deserialization processes of this type behave like for the Set type.
Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:
val string: NotEmptySet<Int> = notEmptySetOf(1, 2, 3)
val encoded: String = Json.encodeToString(string)
println(encoded) // [1,2,3]
val decoded: NotEmptySet<Int> = Json.decodeFromString(encoded)
println(decoded == string) // true
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains static declarations for the NotEmptySet type.