NotEmptyList

@Serializable(with = NotEmptyListSerializer::class)
class NotEmptyList<out E> : List<E>

Representation of lists that contain at least one element.

Parameters

E

The type of elements contained in this list.

Functions

Link copied to clipboard
open operator override fun contains(element: E): Boolean
Link copied to clipboard
open override fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
open operator override fun get(index: Int): E
Link copied to clipboard
open override fun indexOf(element: E): Int
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): Iterator<E>
Link copied to clipboard
open override fun lastIndexOf(element: E): Int
Link copied to clipboard
open override fun listIterator(): ListIterator<E>
open override fun listIterator(index: Int): ListIterator<E>
Link copied to clipboard
open override fun subList(fromIndex: Int, toIndex: Int): List<E>
Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
open override val size: Int

Extensions

Link copied to clipboard

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

Returns a NotEmptyList containing all the elements of this collection, or an IllegalArgumentException if this collection is empty.

Link copied to clipboard
infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a NotEmptyList containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Returns a NotEmptySet containing all the elements of this collection, or an IllegalArgumentException if this collection is empty.

Returns a NotEmptySet containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
infix inline fun <E> Collection<E>.toNotEmptySetOrElse(defaultValue: (Collection<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a NotEmptySet containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard

Returns a NotEmptySet containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard

Returns a NotEmptySet containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.