| Sample Code | Implementing |
| Generics | Learning More |
| Enumeration vs Iterator | Links |
If the class of interest supports both Iterator and Enumeration, use Iterator.
| Enumeration vs Iterator | ||
|---|---|---|
| Enumeration | Iterator Equivalent | Notes |
| Enumeration | Iterator | The name of the interface the doles out the elements one by one. |
| Hashtable.elements Properties.propertyNames Vector.elements |
Collection.iterator | Typical name of method that provides the Enumeration or Iterator. |
| Enumeration.hasMoreElements | Iterator.hasNext | Are there more elements to come? |
| Enumeration.nextElement | Iterator.next | next element |
| java.lang.Iterable | Interface noting that this class is capable of emitting an Iterator with the iterator method. | |
| Works in a for:each statement, e. g. for ( String value : someCollection ) | ||
This page is posted |
http://mindprod.com/jgloss/enumeration.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\enumeration.html | |
![]() |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | |
| Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[216.73.216.63] |
| |
| Feedback |
You are visitor number | |