diff --git a/src/commonMain/kotlin/kotools/types/collection/NotEmptySet.kt b/src/commonMain/kotlin/kotools/types/collection/NotEmptySet.kt index 2d787e144..99a875480 100644 --- a/src/commonMain/kotlin/kotools/types/collection/NotEmptySet.kt +++ b/src/commonMain/kotlin/kotools/types/collection/NotEmptySet.kt @@ -81,7 +81,18 @@ public value class NotEmptySet private constructor( ?: setOf(head) ) - /** Returns all elements of this set as a [Set] of type [E]. */ + /** + * Returns all elements of this set as a [Set] of type [E]. + * + * ```kotlin + * import kotools.types.collection.NotEmptySet + * import kotools.types.collection.notEmptySetOf + * + * val notEmptySet: NotEmptySet = notEmptySetOf(1, 2, 3, 1) + * val set: Set = notEmptySet.toSet() + * println(set) // [1, 2, 3] + * ``` + */ public fun toSet(): Set { val elements: Set = setOf(head) return tail?.let { elements + it.toSet() } ?: elements