Sign in to follow this  
Halsafar

[java] Java Vector -- removeElement(Object)

Recommended Posts

When you call Vector.removeElement(obj) to have the vector eliminate the first instance of the particular object you pass in does it remove the index or set it to null? See I have it working fine, but now it comes to question... When I call removeElement does it just set the index to null or does it remove the index thus collasping the array down a size.

Share this post


Link to post
Share on other sites
The Vector documentation for Vector.removeElement states that both the element and index are removed.

Quote:
Removes the first (lowest-indexed) occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.

Share this post


Link to post
Share on other sites
So in my case since I need the index to remain I should just set that particular index to null.

I did read the java vector javadoc but I didn't find that particular line you posted.

Thanks,
Halsafar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this