Enumeration interface Java Help

Enumeration interface

The output from this program is.shown here:

Initial size: 0
Current capacity: 9
First element: 1
Last element: 2
Vector contains: 3

Elements in vector:

With the release of Java 2, Vector adds support for iterators. Instead of relying o!” an enumeration to cycle through the objects (as the preceding program does), you now can use an iterator. For example, the following iterator-based code can be substituted into the.program: Because enumerations are not recommended for new code, you will usually use an , iterator to enumerate the contents of a vector. Of course, much legacy code exists that employs enumerations.Fortunately, enumerations and iterators work in nearly the ,same manner

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in java util Part 1 The Collections Framework

Share the Story

About the Author

Back to Top