@JsType(name="Set",
isNative=true,
namespace="<global>")
public class JsSet<T>
extends java.lang.Object
implements JsIterable<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
JsSet.ForEachCallback<T> |
static interface |
JsSet.ForEachCallback2<T> |
static interface |
JsSet.ForEachCallback3<T> |
| Constructor and Description |
|---|
JsSet()
The Set constructor lets you create Set objects that store unique values of any type, whether primitive values or object references.
|
JsSet(JsIterable<T> values)
The Set constructor lets you create Set objects that store unique values of any type, whether primitive values or object references.
|
JsSet(T[] values)
The Set constructor lets you create Set objects that store unique values of any type, whether primitive values or object references.
|
| Modifier and Type | Method and Description |
|---|---|
JsSet<T> |
add(T value)
The add() method appends a new element with a specified value to the end of a Set object.
|
void |
clear()
The clear() method removes all elements from a Set object.
|
boolean |
delete(T value)
The delete() method removes a specified value from a Set object, if it is in the set.
|
JsIteratorIterable<JsArray<T>> |
entries()
The entries() method returns a new Iterator object that contains an array of
[value, value] for each element in the Set object, in insertion order. |
void |
forEach(JsSet.ForEachCallback<T> forEachCallback)
The forEach() method executes a provided function once for each value in the Set object, in insertion order.
|
void |
forEach(JsSet.ForEachCallback2<T> forEachCallback)
The forEach() method executes a provided function once for each value in the Set object, in insertion order.
|
void |
forEach(JsSet.ForEachCallback3<T> forEachCallback)
The forEach() method executes a provided function once for each value in the Set object, in insertion order.
|
boolean |
has(T value)
The has() method returns a boolean indicating whether an element with the specified value exists in a Set object or not.
|
JsIteratorIterable<T> |
keys()
The keys() method returns a new iterator object that contains the values for each element in the Set object in insertion order.
|
int |
size()
The size accessor property returns the number of (unique) elements in a Set object.
|
JsIteratorIterable<T> |
values()
The values() method returns a new iterator object that contains the values for each element in the Set object in insertion order.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waititeratorpublic JsSet()
public JsSet(@Nonnull
JsIterable<T> values)
values - the iterable that will have all of it's elements added to the Set.public JsSet(@Nonnull
T[] values)
values - the array that will have all of it's elements added to the Set.@JsProperty(name="size") public int size()
@Nonnull public JsSet<T> add(@Nullable T value)
value - the value of the element to add to the Set object.public void clear()
public boolean delete(@Nullable
T value)
value - the value to remove from the set object.public void forEach(@Nonnull
JsSet.ForEachCallback<T> forEachCallback)
forEachCallback - the function to execute for each element.public void forEach(@Nonnull
JsSet.ForEachCallback2<T> forEachCallback)
forEachCallback - the function to execute for each element.public void forEach(@Nonnull
JsSet.ForEachCallback3<T> forEachCallback)
forEachCallback - the function to execute for each element.public boolean has(@Nullable
T value)
@Nonnull public JsIteratorIterable<JsArray<T>> entries()
[value, value] for each element in the Set object, in insertion order.[value, value] for each element in the given Set, in insertion order.@Nonnull public JsIteratorIterable<T> keys()
@Nonnull public JsIteratorIterable<T> values()