HashSet

class HashSet<E> : MutableSet<E>
open class HashSet<E> : AbstractMutableSet<E> , MutableSet<E>

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

class HashSet<E> : AbstractMutableSet<E> , MutableSet<E> , KonanSet<E>
typealias HashSet = HashSet<E>

Constructors

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

Constructs a new empty HashSet.

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

Constructs a new empty HashSet.

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

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

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

Functions

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

Adds the specified element to the set.

addAll
Link copied to clipboard
Common
open override fun addAll(elements: Collection<E>): Boolean
Native
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
Common
open override fun clear()
open override fun clear()
open override fun clear()

Removes all elements from this collection.

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

Checks if the specified element is contained in this collection.

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

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

Common
open override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
equals
Link copied to clipboard
JS
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
Native
open override fun getElement(element: E): E?

Searches for the specified element in this set.

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

Returns the hash code value for this set.

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

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

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

Returns an iterator over the elements of this object.

remove
Link copied to clipboard
Common
open override fun remove(element: E): Boolean
open override fun remove(element: E): Boolean
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
Common
open override fun removeAll(elements: Collection<E>): Boolean
Native
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
Common
open override fun retainAll(elements: Collection<E>): Boolean
Native
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
JS
open fun toJSON(): Any
toString
Link copied to clipboard
JS
open override fun toString(): String

Properties

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

Returns the size of the collection.

Inheritors

LinkedHashSet
Link copied to clipboard