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 & HelpIntegration › collections from java.util
Page Index Toggle Pages: 1
collections from java.util (Read 1028 times)
collections from java.util
Jun 7th, 2006, 9:32am
 
Hi everybody,
I need to build a collection of custom Objects.

I need to increase the length dynamically and I saw that arrays in Processing have a strict length which you have to declare. I can expand it but only with Array of basic data types (boolean, int float, string...) while I need to push objects in the collection as many as I have.

Maybe I could import in some way collections from namespace java.util...

Could someone help me?
thnks Smiley
Mariano
Re: collections from java.util
Reply #1 - Jun 7th, 2006, 11:06am
 
Maybe you are looking for vectors:

Quote:
 Vector myVector=new Vector();
 MyObject o=new MyObject();
 myVector.add(o);
 MyObject b=(MyObject)myVector.get(0);



Java.util will be automatically imported with your sketch. So you dont need the "import java.util.*" statement.
Page Index Toggle Pages: 1