I'm getting an outofbounds exception from the following code:
myArray.get(myArray.size() - 1)
I know it's due to the fact that myArray contains no items. I tried adding this before checking for the last added item in the array:
If (myArray.size() == -1){ myArray.add(string) }
But that didn't make any difference. What am I doing wrong?
size()returns-1when it's empty?