//---------------------------------------------------------------------------- // ArrayUnsortedList.java by Dale/Joyce/Weems Chapter 6 // // Implements the ListInterface using an array. // // Null elements are not permitted on a list. // // ajg version: Extended BOUNDEDListInterface, DWC, format, // ListOverflowException and isFull() instead of enlarge() // find() is boolean, while-->for //---------------------------------------------------------------------------- package ch06.lists; public class ArrayUnsortedList implements BoundedListInterface { protected T[] list; // array to hold this list's elements protected int numElements = 0;// number of elements in this list protected int currentPos; // current position for iteration protected int location; // find() sets to location of element if found public ArrayUnsortedList(T[] list) { this.list = list; } // Search for an element e such that e.equals(target). Return outcome. // If successful, set location to the array index of e. protected boolean find(T target) { for (location=0; location