Listing 1

import java.util.*;
public class FileList {
private List fileList = new ArrayList();
public void addFile (String name) {
fileList.add(name);
}
public void listExtensions () {
Iterator it = fileList.iterator();
while (it.hasNext()) {
String name = (String) it.next();
System.out.println(getExtension(name));
}
}
// more methods including
// static private String getExtension(String fileName);
}