RetroArrayList.java provides a 1.1 version of ArrayList it implements some of the Java 1.2 List interface
Default constructorPostcondition: Empty list is constructed.
Specific constructorPostcondition: Empty list is constructed with capacity of initialSize.
Add an element to the list at a given position.Precondition: the position is valid.
Postcondition: object has been inserted in the correct position.
Add an element to the list.Postcondition: object has been added to the end of the list.
Return: true if the add was successful.
Clear the list.Postcondition: the list is empty.
Make a shallow copy of the list.Return: a clone of the list.
Does the list contain the element.Return: a true if and only if elem is in the list.
What is the position of the first occurrence of an element in the list.Return: if elem is in the list return its first position, otherwise return -1.
What is the position of the last occurrence of an element in the list.Return: if elem is in the list return its last position, otherwise return -1.
Reduce the size of the array holding the list.Postcondition: the array holding the list has no unused spaces.
Mutator to make sure that the capacity of the array being used for storage is of a minimum size.Postcondition: if the array is too small, a larger array has been allocated and the elements have been copied over.
Size accessorReturn: number of elements in the list
Check if list is emptyReturn: true if list is empty, and false otherwise
Get an object at a given location.Precondition: the index is valid.
Return: the element at the given index.
Change the object at a given location.Precondition: the index is valid.
Precondition: the element at the given index has been changed to element.
Return: the old element at the given position.
Change the object at a given location.Precondition: the index is valid.
Precondition: the element at the given index has been changed to element.
Return: the old element at the given position.
Capacity accessorReturn: number of elements that the array can hold.
Back to the package documentation index