//********************************************************************
//  Beatles.java       Author: Lewis/Loftus
//
//  Demonstrates the use of a ArrayList object.
//********************************************************************

import java.util.ArrayList;

public class Beatles2
{
   //-----------------------------------------------------------------
   //  Stores and modifies a list of band members.
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      ArrayList<String> band = new ArrayList<String>(); // declaration of generic list

      int location;
		
      band.add ("Paul");
      band.add ("Ringo");
      band.add ("John");
      band.add ("George");

      System.out.println (band);
      location = band.indexOf ("Pete");
		System.out.println (location);
      if(location != -1)
		{
		   band.remove (location);
      }
      System.out.println (band);
      System.out.println ("At index 1: " + band.get(1));

      band.add (2, "Ringo");

      System.out.println (band);
      System.out.println ("Size of the band: " + band.size());
   }
}
