Companion

object Companion

Contains static declarations for the NotEmptyList type.

Functions

Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
fun <E> create(collection: Collection<E>): NotEmptyList<E>

Creates a NotEmptyList containing all the elements of the specified collection, or throws an IllegalArgumentException if the collection is empty.

Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
fun <E> createOrNull(collection: Collection<E>): NotEmptyList<E>?

Creates a NotEmptyList containing all the elements of the specified collection, or returns null if the collection is empty.

Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
fun <E> of(head: E, vararg tail: E): NotEmptyList<E>

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