![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Iterator and Enumeration Interface in Java
In this post, we will understand the difference between iterator and enumeration interfaces in Java.
Iterator
It is a universal cursor.
It can be applied to all collection of classes.
It contains the ‘remove’ method.
It is not a legacy interface.
It can be used to traverse over HashMap, LinkedList, ArrayList, HashSet, TreeMap, and TreeSet .
It can perform modifications to perform operations on the collection while traversing through it.
Enumeration
It is not a universal cursor.
It is applied only to legacy classes.
It doesn’t contain the ‘remove’ method.
It is a legacy interface.
This interface acts like a read-only interface.
Hence, no modifications can be performed on a collection while traversing over the elements in a Collection.
It can be used to traverse over Vectors, and Hashtable.