NotEmptySet

@SinceKotoolsTypes(version = "1.3")
class NotEmptySet<out E>(val head: E, tail: E) : AbstractSet<E> , NotEmptyCollection<E>

Represents sets containing at least one element.

Parameters

E

The type of elements contained in this set.

Constructors

Link copied to clipboard
fun <out E> NotEmptySet(head: E, vararg tail: E)

Creates a not empty set starting with a head and containing all the elements of the optional tail.

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 equals(other: Any?): Boolean
Link copied to clipboard
open fun forEach(p0: Consumer<in E>)
Link copied to clipboard
open infix operator fun get(index: PositiveInt): E
open infix operator fun get(index: StrictlyPositiveInt): E

Returns the element at the specified index in this collection, or throws an IndexOutOfBoundsException if the index is out of bounds.

open infix operator override fun get(index: Int): E

Returns the element at the specified index in this collection, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
open infix fun getOrNull(index: Int): E?
open infix fun getOrNull(index: PositiveInt): E?
open infix fun getOrNull(index: StrictlyPositiveInt): E?

Returns the element at the specified index in this collection, or returns null if the index is out of bounds.

Link copied to clipboard
open override fun hashCode(): 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 fun parallelStream(): Stream<E>
Link copied to clipboard
open override fun spliterator(): Spliterator<E>
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
open fun <T : Any> toArray(p0: IntFunction<Array<T>>): Array<T>
Link copied to clipboard

Returns the string representation of this collection as a not blank string.

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

Properties

Link copied to clipboard
open override val head: E

First element of this collection.

Link copied to clipboard
open override val size: Int
Link copied to clipboard

Returns the size of this collection as a strictly positive int.

Extensions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: Int, defaultValue: (Int) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: PositiveInt, defaultValue: (PositiveInt) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: StrictlyPositiveInt, defaultValue: (StrictlyPositiveInt) -> @UnsafeVariance E): E

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyList(): NotEmptyList<E>

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a not empty list 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
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyListOrNull(): NotEmptyList<E>?

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableList(): NotEmptyMutableList<E>

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableListOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableList<E>): NotEmptyMutableList<E>

Returns a not empty mutable list 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
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableListOrNull(): NotEmptyMutableList<E>?

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSet(): NotEmptyMutableSet<E>

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableSetOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableSet<E>): NotEmptyMutableSet<E>

Returns a not empty mutable set 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
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSetOrNull(): NotEmptyMutableSet<E>?

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySet(): NotEmptySet<E>

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

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptySetOrElse(defaultValue: (Collection<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a not empty set 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
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySetOrNull(): NotEmptySet<E>?

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