when i use jdk5 like below
ArrayList<Integer> list = new ArrayList<Integer>();
for (Integer i : list) {
//cannot check if already reached last item
}
on the other hand if i just use iterator
ArrayList<Integer> list = new ArrayList<Integer>();
for (Iterator i = list.iterator(); i.hasNext();) {
//i can check whether this is last item
if(i.hasNextItem()){
}
}
how to check for if alraedy reached last item with for (Integer i : list) {