Jump to content
  • Advertisement
Sign in to follow this  

[java] Java Vector -- removeElement(Object)

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!