I know that iterating through a LinkedList using
for(int i = 0; i < list.size(); i++){
Item item = list.get(i);
}
to get the single objects has bad performance as each call of .get(i) iterates from the beginning of the list up to i.
The correct way would be using an Iterator. So far so good.
But what about this style:
for(Item item : list){
// item is already here
}
Does this have the same performance like using Iterators? How does this work internally?