Perform a Union on Two Sets
In this exercise we are going to perform a union on two sets of data. We will
create a method on our Set
data structure called union
. This method should
take another Set
as an argument and return the union
of the two sets,
excluding any duplicate values.
For example, if setA = ['a','b','c']
and setB = ['a','b','d','e']
, then the
union of setA and setB is: setA.union(setB) = ['a', 'b', 'c', 'd', 'e']
.
Test
{{test}}Console output