Given a List<T>
, which is the preferred way to iterate on Android? Are there any performance differences on a modern day Android device?
for (int i=0; i<list.size(); i++) {
T element = list.get(i);
...
}
or
for (T element : list) {
...
}
Edit: This question is specific to the Android runtime. The other "duplicate" question doesn't address the Android specifics.