Why don't you make use of the Available property of java to perform the Union Operation ?
Follow the Below Steps :
* Import
java.uitl.*
* Declare 2 Sets using the below methods.
Set setName = new HashSet();
setName.add("value");
* Find the Union Using the below method
Set unionSetName = new TreeSet(setName1);
unionSetName.addAll(setName2);
* Print the Values in the Union Set using Iterator
Iterator it = unionSetName.iterator();
while(it.hasNext())
{
System.out.println(in.next());
}
Take a Look at the below link for the Documentation of
Set
interface.
Set Interface[
^]
BR//
Harsha