Iterable is the interface that notes the class has a iterator method capable of emitting a one-shot Iterator object. Since Iterable in a superinterface of Collection, all Collections are Iterable, but not the reverse. The for:each shorthand loop syntax works only on classes that implement Iterable.
Sample Code | Iterable |
Generics | Learning More |
Implementing | Links |
Remove |
Deleting a large number of elements from a large ArrayList will run faster if you create a new ArrayList just the right size, then populate it leaving out the undesirable elements. This avoids the repeated sliding down of all elements above the deleted one. Also processing an ArrayList in descending order to delete is more efficient since remove will not need to slide elements that will be soon deleted.
Here is some sampe code to use Iterator.remove.
![]() ![]() |
This page is posted |
http://mindprod.com/jgloss/iterator.html |
Optional Replicator mirror
|
J:\mindprod\jgloss\iterator.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:[3.19.188.198] |
| |
Feedback |
You are visitor number | |