A Set is a collection that contains no duplicate elements. Below are the methods in which you can iterate a Set
1. For each loop (introduced from Java 5)
2. Array and While loop (here you can use for loop as well)
3. Using Iterator
Please see the below code.