I iterate through an ArrayList this way:
for (T t : list){ ... }
When I did this, I never thought I had to access the previous and next eleme
No, the for-each loop is meant to abstract the Iterator which is under the hood. Accessing it would allow you to retrieve the previous element:
Iterator
ListIterator it = list.listIterator(); while (it.hasNext()) { T t = it.next(); T prev = it.previous(); }
but you can't do it directly with the for-each.