Question: what is difference between iterator and for each loop?
Answer: for-each is syntactic sugar for using iterators (approach 2). You might need to use iterators if you need to modify collection in your loop. First approach will throw exception. The difference is largely syntactic sugar except that an Iterator can remove items from the Collection it is iterating.