NotEmptyList

@Serializable(with = NotEmptyListSerializer::class)
@SinceKotoolsTypes(version = "4.0")
value class NotEmptyList<out E> : NotEmptyCollection<E>

Represents a list with at least one element of type E.

You can use the notEmptyListOf or the toNotEmptyList functions for building this type.

Functions

Link copied to clipboard
fun toList(): List<E>

Returns all elements of this list as a List of type E.

Link copied to clipboard
open override fun toString(): String

Returns the string representation of this collection.

Properties

Link copied to clipboard
open override val head: E

The first element of this collection.

Link copied to clipboard

The size of this collection.

Link copied to clipboard
open override val tail: NotEmptyList<E>?

All elements of this collection except the first one.

Extensions

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
val NotEmptyCollection<*>?.sizeOrZero: PositiveInt

Returns the size of this collection, or returns ZeroInt if this collection is null.