- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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.
- Related Articles
- Difference between Iterator and Enumeration in Java
- What is the difference between Enumeration interface and enum in Java?
- Difference between Iterator and Spilt Iterator in Java.
- Difference Between Iterator and ListIterator in Java
- Difference between an Iterator and ListIterator in Java
- Difference Between Class and Interface in Java
- Difference between Runnable and Callable interface in java
- Difference between Abstract Class and Interface in Java
- Difference Between Thread Class and Runnable Interface in Java
- Difference Between Interface and Abstract Class in Java & C#
- Difference between Python iterable and iterator
- Traverse a collection of objects using the Enumeration Interface in Java
- Difference between default and static interface method in Java 8.
- Difference between peek(), poll() and remove() method of Queue interface in java?
- Difference between abstract class and interface
