NotEmptyMutableSet

@SinceKotoolsTypes(version = "1.3")
class NotEmptyMutableSet<E>(var head: E, tail: E) : AbstractMutableSet<E> , NotEmptyCollection<E>

Represents mutable sets containing at least one element.

Parameters

E

The type of elements contained in this collection.

Constructors

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

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

Functions

Link copied to clipboard
open infix override fun add(element: E): Boolean
Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract override fun clear()
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): 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 isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): MutableIterator<E>
Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
open infix override fun remove(element: E): Boolean
Link copied to clipboard
abstract override fun removeAll(elements: Collection<E>): Boolean
Link copied to clipboard
open fun removeIf(p0: Predicate<in E>): Boolean
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean
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 toArray(): Array<Any>
open fun <T : Any> toArray(p0: Array<T>): Array<T>
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.

Properties

Link copied to clipboard
open override var 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.