Set<T>
package js.lib
Available on js
The js.Set
object lets you store unique values of any type, whether primitive values or object references.
Documentation Set by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Constructor
new(?iterable:Any)
If an iterable object is passed, all of its elements will be added to the new js.Set
.
Variables
read onlysize:Int
The number of values in the js.Set
object.
Methods
add(value:T):Set<T>
Appends a new element with the given value to the js.Set
object. Returns the js.Set
object.
clear():Void
Removes all elements from the js.Set
object.
delete(value:T):Bool
Removes the element associated to the value and returns the value that has(value)
would have previously returned. has(value)
will return false
afterwards.
entries():Iterator<KeyValue<T, T>>
Returns a new js.lib.Iterator
object that contains an array of [value, value]
for each element in the js.Set
object, in insertion order. This is kept similar to the js.Map
object, so that each entry has the same value for its key and value here.
forEach(callback:(value:T, key:T, set:Set<T>) ‑> Void, ?thisArg:Any):Void
Calls callback
once for each key-value pair present in the js.Set
object, in insertion order.
If a thisArg
parameter is provided to forEach, it will be used as the this
value for each callback.
has(value:T):Bool
Returns a boolean asserting whether an element is present with the given value in the js.Set
object or not.
inlineiterator():HaxeIterator<T>
inlinekeyValueIterator():SetKeyValueIterator<T>
keys():Iterator<T>
Returns a new js.lib.Iterator
object that contains the keys for each element in the js.Set
object in insertion order.
values():Iterator<T>
Returns a new js.lib.Iterator
object that contains the values for each element in the js.Set
object in insertion order.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/lib/Set.html