import java.util.ArrayList;
import java.util.Collections;
import javax.swing.JOptionPane;
/*
 * ArrayListExample3.java
 *
 * Created on February 27, 2005, 12:45 PM
 *
 * @author Bill Kraynek
 */
public class ArrayListExample3 {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ArrayList<String> words = new ArrayList<String>();
        words.add("Florida");
        words.add("International");
        words.add("University");
        words.add("School");
        words.add("of");
        words.add("Computer");
        words.add("Science");
        JOptionPane.showMessageDialog(null,words + ". Index of \"of\" = " + words.indexOf("of"));
        Collections.sort(words);
        JOptionPane.showMessageDialog(null,words + ". Index of \"of\" = " + words.indexOf("of"));
        words.remove("of");
        JOptionPane.showMessageDialog(null,words + " Index of \"of\" = " + words.indexOf("of"));
        String first = words.get(0);
        String second = words.get(1);
        String last = words.get(words.size()-1);
        String computer = words.get(words.indexOf("Computer"));
        JOptionPane.showMessageDialog(null,first + "\n"+ second + "\n" + last + "\n" + computer);
    }
    
}

