public static <T> void forEach(ArrayList<T> list, int from, int to, Procedure<? super T> procedure)
    {
        ListIterate.rangeCheck(from, to, list.size());
        if (ArrayListIterate.isOptimizableArrayList(list, to - from + 1))
        {
            T[] elements = ArrayListIterate.getInternalArray(list);

            InternalArrayIterate.forEachWithoutChecks(elements, from, to, procedure);
        }
        else
        {
            RandomAccessListIterate.forEach(list, from, to, procedure);
        }
    }
public static < T > void forEach ( ArrayList < T > list , int from , int to , Procedure < ? super T > procedure ) { ListIterate . rangeCheck ( from , to , list . size ( ) ) ; if ( ArrayListIterate . isOptimizableArrayList ( list , to - from + 1 ) ) { T [ ] elements = ArrayListIterate . getInternalArray ( list ) ; InternalArrayIterate . forEachWithoutChecks ( elements , from , to , procedure ) ; } else { RandomAccessListIterate . forEach ( list , from , to , procedure ) ; } }
Iterates over the section of the list covered by the specified indexes.  The indexes are both inclusive.  If the
from is less than the to, the list is iterated in forward order. If the from is greater than the to, then the
list is iterated in the reverse order.
<p>
<pre>e.g.
ArrayList<People> people = new ArrayList<People>(FastList.newListWith(ted, mary, bob, sally));
ArrayListIterate.forEach(people, 0, 1, new Procedure<Person>()
{
public void value(Person person)
{
LOGGER.info(person.getName());
}
});
</pre>
<p>
This code would output ted and mary's names.