I am asked to create an add method with the following rules: When adding new elements, check to ensure there is room in the array data. If there is no unused array index, grow the array by delta elements. When removing existing elements, shrink the array by delta elements whenever there is room to add more than delta elements. In other words, leave no more than delta empty array locations at any time. The array must have from 0 through delta empty indexes at all times. The following assertions must pass.
This add method must work for any data type. And so far the method that I have create is:
The problem with this code is that when I try to add an interger it always gives me a null point exception because all the value in the array are set as null the very first time, how do I get this method to work the way it's suppose to be??>
EDIT by mw: Added Code Tags. [ February 03, 2007: Message edited by: marc weber ]