HashSet

expect class HashSet<E> : MutableSet<E>
actual typealias HashSet = HashSet<E>
actual open class HashSet<E> : AbstractMutableSet<E> , MutableSet<E>

The implementation of the MutableSet interface, backed by a HashMap instance.

actual class HashSet<E> : AbstractMutableSet<E> , MutableSet<E> , KonanSet<E>

Constructors

HashSet
Link copied to clipboard
expect fun HashSet()
actual fun HashSet()

Constructs a new empty HashSet.

actual fun HashSet()
HashSet
Link copied to clipboard
expect fun HashSet(initialCapacity: Int)
actual fun HashSet(initialCapacity: Int)
actual fun HashSet(initialCapacity: Int)
HashSet
Link copied to clipboard
expect fun HashSet(initialCapacity: Int, loadFactor: Float = 0.0f)
actual fun HashSet(initialCapacity: Int, loadFactor: Float = 0.0f)

Constructs a new empty HashSet.

actual fun HashSet(initialCapacity: Int, loadFactor: Float = 0.0f)
HashSet
Link copied to clipboard
expect fun <E> HashSet(elements: Collection<E>)
actual fun <E> HashSet(elements: Collection<E>)

Constructs a new HashSet filled with the elements of the specified collection.

actual fun <E> HashSet(elements: Collection<E>)

Functions

add
Link copied to clipboard
expect open override fun add(element: E): Boolean
actual open override fun add(element: E): Boolean

Adds the specified element to the set.

actual open override fun add(element: E): Boolean

Adds the specified element to the set.

addAll
Link copied to clipboard
expect open override fun addAll(elements: Collection<E>): Boolean
actual open override fun addAll(elements: Collection<E>): Boolean

Adds all of the elements of the specified collection to this collection.

clear
Link copied to clipboard
expect open override fun clear()
actual open override fun clear()

Removes all elements from this collection.

actual open override fun clear()

Removes all elements from this collection.

contains
Link copied to clipboard
expect open operator override fun contains(element: @UnsafeVariance E): Boolean
actual open operator override fun contains(element: E): Boolean

Checks if the specified element is contained in this collection.

actual open operator override fun contains(element: E): Boolean

Checks if the specified element is contained in this collection.

containsAll
Link copied to clipboard
expect open override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
open override fun containsAll(elements: Collection<E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

abstract override fun containsAll(elements: Collection<E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares this set with another set instance with the unordered structural equality.

getElement
Link copied to clipboard
open override fun getElement(element: E): E?

Searches for the specified element in this set.

hashCode
Link copied to clipboard
open override fun hashCode(): Int

Returns the hash code value for this set.

isEmpty
Link copied to clipboard
expect open override fun isEmpty(): Boolean
actual open override fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

actual open override fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

iterator
Link copied to clipboard
expect open operator override fun iterator(): MutableIterator<E>
actual open operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

actual open operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

remove
Link copied to clipboard
expect open override fun remove(element: E): Boolean
actual open override fun remove(element: E): Boolean

Removes a single instance of the specified element from this collection, if it is present.

actual open override fun remove(element: E): Boolean

Removes a single instance of the specified element from this collection, if it is present.

removeAll
Link copied to clipboard
expect open override fun removeAll(elements: Collection<E>): Boolean
actual open override fun removeAll(elements: Collection<E>): Boolean

Removes all of this collection's elements that are also contained in the specified collection.

retainAll
Link copied to clipboard
expect open override fun retainAll(elements: Collection<E>): Boolean
actual open override fun retainAll(elements: Collection<E>): Boolean

Retains only the elements in this collection that are contained in the specified collection.

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

Properties

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

Returns the size of the collection.

Inheritors

LinkedHashSet
Link copied to clipboard