android
android

Reputation: 666

Difference between Enumerator and Enumeration in java

Can any one please give clarification about these? I am really confused.

Upvotes: 1

Views: 2571

Answers (3)

kosa
kosa

Reputation: 66647

Enumeration is process of loop through the collection (Enumeration) (Generally called as Enumerator).

Enums are different.

An enum type is a type whose fields consist of a fixed set of constants

Upvotes: 4

Sriram
Sriram

Reputation: 2999

Enum - Define a set of constants and use it where ever required.

java.util.Enumeration helps iterate through a set of objects using .nextElement().

Upvotes: 0

Ajay George
Ajay George

Reputation: 11875

Enumeration is an interface :

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Enumeration.html

An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.

Enumerators are a generic term. More of on the lines of Iterator.

Upvotes: 1

Related Questions