4.9 ArrayList Traversals
- Develop code used to traverse the elements of an
ArrayListand determine the results of these traversals
Assignment
- All vocabulary
- All 4.9 activities
- 4.33 Code Practice with ArrayLists
Save for one caveat, this is a practice section. You’ve used loops and traversed arrays before, so little here is new.
The one catch is that you have to be careful when adding or removing items while looping through an ArrayList. Doing either will both change the size of the array and move items around, which you need to account for to avoid any errors.
Also, enhanced for loops can’t used in situations where the ArrayList changes size.