How to use Iterator in HashMap in Java Program
|Top Tutorials||New Tutorials||Submit||Login||Register|
Total Hits: 10552
Total Votes: 139 votes
Submitted on: 2011-11-02 06:28:58
Submitted By: Javin Paul
Description:Iterators in Java are core of Collection package. They provide most important traversing functionality around objects stored in Collections.
No matter whether your objects are stored inside ArrayList, LinkedList, HashMap, HashSet or Vector , you can effectively use Iterator to navigate inside collection and same time remove objects from Collection safely. There are two kinds of Iterator in Java fail-safe and fail-fast, fail-safe iterator handles failure scenario elegantly while fail-fast iterator throws ConcurrentModification Exception. This article gives a nice overview of Java Iterator and ListIterator and suggest how can you use both iterators based on scenarios and requirement. More detail...