There is a cycle:
for (Contact cn : contacts) What does the colon mean and how to write in the classical form?
This is the classic type of foreach loop.
There is a certain object being iterated (for example, an array or a collection) of contacts , in which elements are of type Contact (or can be brought to it). For each element, the body of the loop is executed, in which it has the name cn .
This is the so-called range-based loop. Classic equivalent:
for (i = 0; i < contacts.size(); ++i) { Contact cn = contacts[i] ... } contacts is an array. - Qwertiy ♦contacts array or list. If the array is, then its length is ARRAY.lenght , if the List , then you need to get the element through LIST.get(i) . Neither there nor here it turns out) - YuriySPb ♦Source: https://ru.stackoverflow.com/questions/647251/
All Articles