(.js)
laraImport("lara.util.StringSet");
(.lara)
import lara.util.StringSet;
Classes:
new StringSet([args = []])
Based on this code: https://stackoverflow.com/questions/4343746/is-there-a-data-structure-like-the-java-set-in-javascript
Changed the name of functions 'contains' to the name used in ECMAScript 6 ('has').
'remove' has not been changed to 'delete' because in LARA 'delete' is a keyword and cannot be used as a function name
Also, tweaked the functionality of 'add' and 'delete' to behave similarly to ECMAScript 6 Set.
difference(setA, setB)
intersection(setA, setB)
union(setA, setB)
Symbol.iterator
Implement the generator. StringSet can be used e.g. in `for...of`
add(str)
Add an element to the set
copy()
difference(otherSet)
Stores in this set the difference of it with another another set (i.e.
`this - otherSet`). Notice that is not equivalent to `otherSet - this`.
has(str)
Check if element exists in the set
intersection(otherSet)
Stores in this set the intersection of it with another another set
isEmpty()
remove(str)
Remove an element from the set if it exists
toString()
union(otherSet)
Stores in this set the union of it with another another set
values()