Does Java's foreach loop start at the first object and in a linear fashion work it's way to the end? For example
String[] names = new String[] {"Zoe", "Bob", "Charlie", "Alex"}; for(String name : names) { //do stuff... } Is the string "Zoe" always processed first, followed by "Bob" etc? No sorting happens? I've tested it out myself and haven't found any but I need a guarantee and couldn't find anything in the docs.
Strings?For other lists ... this might not be true!you're right that it might not be true but the definition of a list contains a specified/deterministic order so if it is not true for a certain list I'd not call it a list anymore. :)