Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does enumeration in java mean?
What does enumeration in java mean?

Java's Enumeration (enumeration, comment ②) is an example of an iterator with these restrictions. Except for the following, you cannot use it to do anything else:

(1) Use a method called elements() to ask the collection to provide us with an Enumeration. The first time we call its nextElement(), this Enumeration will return the first element in the sequence.

(2) Use nextElement() to obtain the next object.

(3) Use hasMoreElements() to check whether there are more objects in the sequence.

②: The word "repeater" appears frequently in C++ and other places in OOP, so it is difficult to determine why Java developers adopted such a strange name. Java 1.2's collections library fixes this problem and many others.