Java For-Each Loop : Sort order

Viewed 54540

Does a java for-each loop guarantee that the elements will be presented in order if invoked on a list? In my tests it does seem to, but I can't seem to find this explicitly mentioned in any documentation

List<Integer> myList;// [1,2,3,4]
for (Integer i : myList) {
  System.out.println(i.intValue());
}

#output
1,2,3,4
4 Answers
Related