I wonder if there is a difference between these:
ArrayList<Example> list = new ArrayList<Example>
1-)
for(int i = 0; i < list.size(); i++) {
list.get(i).doSomething();
}
2-)
for(Example example : list) {
example.doSomething();
}
If there is not any difference which one is more common or efficient?