1: public Object clone() 2: { 3: AList<T> theCopy = null; 4: 5: // Clone the list 6: try 7: { 8: @SuppressWarnings("unchecked") 9: AList<T> temp = (AList<T>)super.clone(); 10: theCopy = temp; 11: } 12: catch (CloneNotSupportedException e) 13: { 14: throw new Error(e.toString()); 15: } 16: 17: // Clone the list's array 18: theCopy.list = list.clone(); 19: 20: // Clone the entries in the array (list[0] is unused and ignored) 21: for (int index = 1; index <= numberOfEntries; index++) 22: { 23: @SuppressWarnings("unchecked") 24: T temp = (T)list[index].clone(); 25: theCopy.list[index] = temp; 26: } // end for 27: 28: return theCopy; 29: } // end clone 30: // Version 4.0