Tutorials Shared by the Internet Community
|Top Tutorials||New Tutorials||Submit||Login||Register|
Tutorial Basic Detail
Total Hits: 15640
Total Votes: 148 votes
Average Rating: 2.86 out of 5
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.