Can any one please give clarification about these? I am really confused.
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
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.
Enum
- Define a set of constants and use it where ever required.
java.util.Enumeration
helps iterate through a set of objects using .nextElement()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.