for loop for set in java code example
Example: set iteration java
import java.util.HashSet;
import java.util.Set;
class IterateHashSet{
public static void main(String[] args) {
Set<String> hset = new HashSet<String>();
hset.add("Chaitanya");
hset.add("Rahul");
for (String temp : hset) {
System.out.println(temp);
}
}
}