HashSet

open actual class HashSet<E> : 
    AbstractMutableSet<E>,
    MutableSet<E>
(source)

Platform and version requirements: JS

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

Constructors

<init>

HashSet()
HashSet(initialCapacity: Int, loadFactor: Float = 0.0f)

Constructs a new empty HashSet.

HashSet(elements: Collection<E>)

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

HashSet(initialCapacity: Int)

Properties

size

open actual val size: Int

Returns the size of the collection.

Functions

add

open actual fun add(element: E): Boolean

Adds the specified element to the collection.

clear

open actual fun clear()

Removes all elements from this collection.

contains

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

Checks if the specified element is contained in this collection.

isEmpty

open actual fun isEmpty(): Boolean

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

iterator

open actual fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

remove

open actual fun remove(element: E): Boolean

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

Inherited Functions

equals

open fun equals(other: Any?): Boolean

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

hashCode

open fun hashCode(): Int

Returns the hash code value for this set.