Make ArrayList and ArrayListIterator safer - no removeAt out of bounds, no remove() twice in a single iteration. Add test for that. Closes #672