notEmptySetOf

fun <E> notEmptySetOf(head: E, vararg tail: E): NotEmptySet<E>

Creates a NotEmptySet starting with a head and containing all the elements of the optional tail.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val integers: NotEmptySet<Int> = notEmptySetOf(1, 2, 3, 1)
assertEquals(expected = "[1, 2, 3]", actual = "$integers")

Since

4.0.0