A brief primer on the ArrayList for CSC 360 students who have not used this before. An ArrayList is a class in Java. It represents a list of items, stored in an array. The advantage of using an ArrayList over an array is that it already has implemented in it a number of methods that allow you to add to, search, and remove elemetns without having to implement your own search via a for loop. The primary detractors of the ArrayList are that it can only store Objects, not primitive types (but you can use a Wrapper class like Integer if you need to store an array of ints) and you do not know how well implemented the methods are so that you might be using less efficient code that something you could write yourself. The ArrayList class is part of the java.util library so you must import java.util.ArrayList or java.util.*. When declaring a variable of type ArrayList, specify the Object type in < > (this is something known as Generics which we will cover toward the end of the semester). ArrayList listOfIntegers; ArrayList myNames; When instantiating your ArrayList, use = new ArrayList(); or = new ArrayList<>(); listOfIntegers=new ArrayList(); myNames=new ArrayList<>(); Omitting the type from <> is perfectly acceptable. Now pass your ArrayList object messages: myNames.add("Frank Zappa"); -- add the item to the end of the ArrayList myNames.add("Frank Zappa", 5); -- insert the item at index 5, sliding any other items up as needed myNames.clear(); -- delete everything myNames.contains("Ruth Underwood"); -- return true if the item is somewhere in the list myNames.get(i); -- return the item at index i myNames.indexOf("Frank Zappa") -- return index of first matching occurrence of "Frank Zappa" if it is in myNames, -1 otherwise myNames.lastIndexOf("Frank Zappa") -- same as indexOf but returns last index of "Frank Zappa" myNames.remove("Frank Zappa") -- removes "Frank Zappa" from the list (first occurrence), does nothing if "Frank Zappa" is not in the list myNames.remove(i) -- deletes item at index i, sliding other elements down (e.g., a.remove(5) moves element 6 to 5, 7 to 6, etc) myNames.size() -- returns size of list (number of elements stored) myNames.set(i, "Frank Zappa") -- places "Frank Zappa" at index i, deleting anything that may have been at i, but index must be between 0 and size-1 to be valid myNames.addAll(yourNames); -- concatenates the items in ArrayList yourNames onto myNames, yourNames must store the same type of object as myNames (Strings in this example) For more examples, see pages 431-435.