Declaring the Array List
ArrayList List_Of_Links = new ArrayList();
Adding to the List
if (!duplicate)
{
System.out.println(" -- adding the link " + tempstring + " to the master list");
List_Of_Links.add (tempstring);
}
Processing the List
for (int i=0; i<List_Of_Links.size(); i++)
{
search_file ((String) List_Of_Links.get(i));
}
Alternative Code
List<string> MyList = new ArrayList<string>();
...
for (string nextItem : MyList)
{
...
System.out.println (nextItem);
}
Other Useful Methods
List_Of_Links.contains ("bob.htm"); // returns true or false
List_Of_Links.indexOf ("bob.htm"); // returns array index of bob.htm, or -1 if its not in the arraylist
List_Of_Links.remove (4); // removes 4th element of the list