I'm trying to delete an object that I created in an ArrayList:
turtles.add(new Turtle());
I want to get rid of the last turtle in the ArrayList, something like this:
turtles.get(turtles.size() - 1) = null;
Any ideas? Simply removing from the list doesn't work, and Java won't let me nullify in the above way. I'm pretty sure there is only be a single reference to a given Turtle object, as they are only ever created in this way.
P.S: The Turtle class is a thread, in case that matters.