Check bounds when deleting from arraylist