Class JsSet<V>
java.lang.Object
com.vaadin.client.flow.collection.JsSet<V>
- Type Parameters:
V- the value type
- Direct Known Subclasses:
JreJsSet
Native JS Set interface with an alternative implementation for JRE usage. Use
JsCollections.set() to create an appropriate instance.- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a value to this set, overwriting any previous value if present.voidclear()Removes all values from this set.booleanRemoves the given value from the set.voidforEach(JsCollections.ForEachCallback<V> callback) Invokes the provided callback for each value in this set.booleanChecks whether this set contains the given value.final booleanisEmpty()Checks if the set is empty (size == 0).intsize()Gets the number of values in this set.
-
Constructor Details
-
JsSet
public JsSet()Creates a new instance.
-
-
Method Details
-
add
Adds a value to this set, overwriting any previous value if present.- Parameters:
value- the value to add- Returns:
- this set, for chaining.
-
has
Checks whether this set contains the given value.- Parameters:
value- the value to check for- Returns:
trueif the value is in the set;falseotherwise
-
delete
Removes the given value from the set.- Parameters:
value- the value to remove- Returns:
trueif the map contained the value prior to calling this method;falseotherwise
-
clear
public void clear()Removes all values from this set. -
forEach
Invokes the provided callback for each value in this set.- Parameters:
callback- the callback to invoke for each value
-
size
@JsProperty(name="size") public int size()Gets the number of values in this set.- Returns:
- the value count
-
isEmpty
@JsOverlay public final boolean isEmpty()Checks if the set is empty (size == 0).- Returns:
trueif the set is empty,falseotherwise
-