(int value)
| 24 | |
| 25 | //insert function |
| 26 | public void insert(int value) |
| 27 | { |
| 28 | //if size is less than defined size regular addition |
| 29 | if (size > i) |
| 30 | { |
| 31 | lastIndex++; |
| 32 | arr[lastIndex] = value; |
| 33 | i++; |
| 34 | display(); |
| 35 | } |
| 36 | |
| 37 | //if the size is more then it first increases the size and then performs addition in the array |
| 38 | else |
| 39 | { |
| 40 | increaseSize(); |
| 41 | lastIndex++; |
| 42 | arr[lastIndex] = value; |
| 43 | i++; |
| 44 | display(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | //incrase size function - it doubles the size and copie the elements of old array in the new array |
| 49 | private void increaseSize() |
no test coverage detected