Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the differences between enumeration and iterator?

0
Posted

What are the differences between enumeration and iterator?

0
Javin Paul

Between two Enumeration is older and its there from jdk 1.0 while iterator was introduced later.

The functionality of Enumeration interface is duplicated by the Iterator interface.
Iterator has a remove() method while Enumeration doesn’t. Enumeration acts as Read-only interface, because it has the methods only to traverse and fetch the objects, where as using Iterator we can manipulate the objects also like adding and removing the objects.

to read more see here difference between iterator and enumeration

Thanks
Javin
deadlock in java

 

1

Both of the two Java interfaces implement the iterator pattern [EG/RH/RJ/JV,1994], more specifically that of an external iterator [external: the data structure advancing is controlled by the client, which offers more flexibility].

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123