We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › destroying objects from vector
Page Index Toggle Pages: 1
destroying objects from vector (Read 785 times)
destroying objects from vector
Aug 14th, 2009, 3:13pm
 
hello, i have a vector that is full of objects, each object is an agent, how can i delete an specific object from my vector?


thanks


Re: destroying objects from vector
Reply #1 - Aug 14th, 2009, 3:20pm
 
You have a 'vector' that is full of objects?  That doesn't make a lot sense.  Do you mean an array or ArrayList?
Re: destroying objects from vector
Reply #2 - Aug 14th, 2009, 7:44pm
 
i mean vector like this:
agents = new Vector();

 for (int i = 0; i < numAgents; i++)
 {

   agents.add(new Agent_values(random_x, random_y));

}
Re: destroying objects from vector
Reply #3 - Aug 14th, 2009, 9:38pm
 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html#remove%28int%29
Page Index Toggle Pages: 1