import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
publicclass Main {
publicstaticvoid main(String[] argv) throws Exception {
Set collection = new HashSet();
// For a set or list
for (Iterator it = collection.iterator(); it.hasNext();) {
Object element = it.next();
}
}
}