in Technology by
What is the Main difference between Iterator and Enumeration in JAVA?

1 Answer

0 votes
by

Below are the four main difference between Iterator and Enumeration

(1)Iterator:-Iterator in java is an interface which is found in java.util package.

(1)Enumeration:-On the other hand Enumeration is an object that will creates elements but one at a time.

(2)Iterator:-Here we uses three methods to interface

(i)hasNext()

(ii)next()

(iii)remove()

(2)Enumeration:-Here we uses two methods

(i)hasMoreElements()

(ii)nextElement()

(3)Iterator:-Iterators allow removing elements from the given collection during the iteration with well-defined semantics.

(3)Enumeration:-It is used for passing through a collection, usually of unknown size.

(4)Iterator:-Iterator method names have been improved.

(4)Enumeration:-Here traversing of elements can only be done once per creation.

Related questions

0 votes
    What is the difference between Iterator and Enumeration in JAVA?...
asked May 26, 2021 in Education by JackTerrance
0 votes
    What is the difference between Iterator and ListIterator?...
asked May 26, 2021 in Technology by JackTerrance
0 votes
    The iterator maintains the __________ of its execution in between calls so that successive next() requests ... Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    The main difference between SNMPv3 and SNMPv2 is _______. A. Enhanced security B. Integration C. Management D. Integration...
asked Feb 14, 2023 in Technology by JackTerrance
0 votes
    What Is The One Main Difference Between Ups & Inverter ? And Electrical Engineering & Electronics Engineering ?...
asked Dec 12, 2020 in Technology by JackTerrance
0 votes
    What is the main difference between Kafka and Flume?...
asked Nov 1, 2020 in Technology by JackTerrance
0 votes
    The main difference between application and system software is that: 1 point Application software is stored in memory ... for computer Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    What is the main difference between what we see in the two pictures alongside (A and B). ... Science,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    What is the main difference between localStorage and sessionStorage? (a) Lifetime (b) Scope (c) Both ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    What is the main difference between GraphQL and REST?...
asked Jun 13, 2021 in Education by Editorial Staff
0 votes
    What's the main point of difference between human & machine intelligence? (a) human perceive everything as a pattern ... ) human have sense organs Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    What was the main point of difference between the adaline & perceptron model? (a) weights are compared with output (b ... (d) all of the mentioned Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    What is enumeration in ethical hacking?...
asked Feb 16, 2021 in Technology by JackTerrance
0 votes
    What is fast enumeration in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
...