import java.util.ArrayList;
import java.util.Iterator;
...
/**
* List of filename/count pairs. Definition of Pair class not shown.
*/
static final ArrayList<Pair> pairs = new ArrayList<Pair>();
/**
* debug dump of all the Pairs in the list
*/
static void dumpPairs()
{
Iterator<Pair> iter = pairs.iterator();
while ( iter.hasNext() )
{
Pair aPair = iter.next();
out.println( aPair.filename + " " + aPair.count );
}
}
/**
* or better still, use the for each loop
*/
static void dumpPairs()
{
Iterator<Pair> iter = pairs.iterator();
for ( Pair aPair : iter )
{
out.println( aPair.filename + " " + aPair.count );
}
}