answersLogoWhite

0

What is difference Iterator and Enumeration?

Updated: 8/19/2019
User Avatar

Wiki User

12y ago

Best Answer

1.Iterator has remove method while enumeration doesn't have it.

2.Iterator is new in Java API but Enumeration is older one.

3. Iterator extends functionality of Enumeration.

4. Iterator is more secure and safe as compared to Enumeration because it does not allow other thread to modify the collection object while some thread is iterating over it and throws ConcurrentModificationException.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is difference Iterator and Enumeration?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is Re usability in java?

Reusability in Java means that once you write some code, you can use it over and over again - if you write it so that it can be reused. For example, if you write a Enumeration-Iterator adapter, or some code that lets you treat an Enumeration - Java legacy code - as an Iterator - shiny NEW Java code - then you can use it not only in your animal simulation program, but also in your Jacuzzi interface program.


What is the difference between an enumeration and macro?

In enumeration, values can be generated for us but in macros we have to give value for every macro template and type checking can be done in enums.


What is an enumeration sentence?

enumeration sentence can be used in a sentence as such. enumeration means numbered words..


What does Amendment Nine talks about the enumeration of rights. Enumeration means a .?

Enumeration means a LIST.Hope this answered your question.


Is Iterator a class or Interface?

Its an interface.


What is the hasnext method?

Iterator.hasNext() is one of the two main methods of the Iterator interface. It can be used on an Iterator to find out if there are any remaining objects to iterate over. For example, it would be used like this: Iterator iter = ...; while (iter.hasNext()) { // do something with iter.next()... }


What is the Tagalog word for enumeration?

Tagalog word of enumeration: isa-isahin


Why do you have enumeration?

There are different methods for naming a integer constant, one such method is enumeration. Enumeration is created by using the keyword enum.


How do you write method pubic boolean containsString s Return whether the given string is in the array or not?

Return an iterator to the string if it exists, or the container's end iterator if it does not.


What does a Sample of a letter with enumeration look like?

sample of letter with enumeration


What are the various functions in iterator class in java?

There are mainly three Methods available in the iterator class in java. Namely they are ... 1. Has Next 2. Next and 3. Remove.


What is ITER?

Wikipedia, the free encyclopedia says, "In computer science, an iterator is an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation. An iterator is sometimes called a cursor, especially within the context of a database."Source: http://en.wikipedia.org/wiki/Iterator