what is diff bet iterator and enumeration?
Answers were Sorted based on User's Feedback
Answer / muralisankar
Both are to navigate collection objects. But Enumerator you
can not manipulate where as in Iterator you can add and
remove objects.
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / siva thimmannagari
Iterator supports only hasNext(),
next() and remove() methods.
It is not synchronized.
Enumeration supports ONLY
hasMoreElements(), nextElement().
It is synchronized.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / aslam
Iterator has an additional method remove() and also
iterator checks for the concurrent modifications which will
be useful in multi threaded applications.
while Enumerator is much faster for sequential
access over collection elements, because it doesnot have
the additional overhead of checking concurrent modifications
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / raju
From my experiance shows Enumeration is thread safe ..
| Is This Answer Correct ? | 1 Yes | 4 No |
How to declare an arraylist in java?
I have an HashMap object, which has with key and value pair. It has 10 keys and values in that object. Now the question is I want insert new key and value in middle or any where in that list but not at the end or at the top. Is it possible or not. If yes how can we achieve this one?
How to solve the problem of generating the unique hash keys with hash function?
Hi can u pls tell me what is the use of marker interface. Iknow what is marker interface but what ability will the object get by implementing this.
adapter class ?
what are the design patterns in struts?
Can we have try without catch block?
How many digits can a float hold?
What is lambda programming?
Which is fastest collection in java?
What do you know about java?
How does the garbage collector works in java?