Index
Examples


We really want to understand capacity well so here is another perspective.

We will use the dynamic array by sending messages to it like get, subList, first, last, etc.

All of these public methods only apply to the "Public Data"
  • get(0) is 10
  • get(1) is 20
  • get(2) is 30
  • get(3) is 40
  • get(4) is an EXCEPTION -- out of bounds

Access is from 0 to (size-1)
Here is a case where we have no elements (size = 0).

We could not do any access methods like get, first, last, etc. There is no pubic data.
We are about to remove element 20.
We need to do some shifting to remove the removed slot in the accessible zone.