Skip to content

Commit

Permalink
Added comment clarifying size vs capactity of dynamic array
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Rasmusson committed Oct 15, 2019
1 parent 1fdfbd6 commit ced3bb2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/datastructures/DynamicArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
public class DynamicArray<String> {

private Object[] data;

// Counter for the number of elements in our array
private int size = 0;

// The capacity of our array - or how many elements it can hold.
// What we double when the number of elements exceeds the capacity of the array.
private int initialCapacity;

public DynamicArray(int initialCapacity) {
Expand Down

0 comments on commit ced3bb2

Please sign in to comment.