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. The for:each shorthand loop syntax works only on collections than implement Iterable.
| Sample Code | Remove |
| Generics | Learning More |
| Implementing | Links |
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.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 45,876. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/iterator.html | J:\mindprod\jgloss\iterator.html | ||