Warning! The new syntax (for (i : I), I<C>) isn't supported in Processing, unless you use it in .java files.
I am not sure to understand 1), but there is a add(int index, E element) method in ArrayList. Unlike a pure array, this add pushes up the previous elements and you cannot add at arbitrary places, only within the size().
Example:
Code:ArrayList al = new ArrayList(10);
// If I don't put this line, the add below will throw an error
for (int i = 0; i < 10; i++) al.add(">--" + i);
al.add(1, "One");
al.add(3, "Three");
al.add(5, "Five");
al.add(8, "Eight");
ListIterator it = al.listIterator();
while (it.hasNext())
{
int i = it.nextIndex();
String s = (String) it.next();
println(i + " " + s);
}
2) In old syntax, when you do a get() (or a next()), you have a generic Object. You have to cast (like above) the object to its real type to be able to access the inner variables (fields of the class).
3) I am not sure to understand the question.