To add a value to a Set, use the .add()
method:
mySet.add(5);
If the value already exist in the set it will not be added again, as Sets contain unique values.
Note that the .add()
method returns the set itself, so you can chain add calls together:
mySet.add(1).add(2).add(3);