Skip to content

Commit

Permalink
Merge pull request #13
Browse files Browse the repository at this point in the history
FIXED ISSUE[#10]
  • Loading branch information
pitzzahh authored Oct 11, 2022
2 parents e470fab + a99fa55 commit b9dcc04
Showing 1 changed file with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,13 @@ public final class DynamicArray<T> implements Serializable {
* The array where the elements are stored.
* Called balloon because balloon expands as you add air to it.
*/
transient Object[] balloon;
transient Object[] balloon = {};

/**
* placeholder for any insert modification in the dynamic array.
*/
transient int modificationCount;

/**
* No args dynamic array. Sets the dynamic array size to default size of 10.
*/
public DynamicArray() {
this.balloon = new Object[] {};
}

/**
* Creates a {@code DynamicArray} object with an initial size
* @param initialSize the initial size of the array.
*/
public DynamicArray(int initialSize) {
if (initialSize > 0) this.balloon = new Object[initialSize];
else if (initialSize == 0) this.balloon = new Object[]{};
else throw new IllegalArgumentException("Illegal Capacity: " + initialSize);
}

/**
* Insert an element in the dynamic array.
* @param element the element to be inserted.
Expand Down

0 comments on commit b9dcc04

Please sign in to comment.