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 › Import question ??
Page Index Toggle Pages: 1
Import question ???? (Read 844 times)
Import question ????
May 15th, 2010, 3:10am
 
I'm wondering if it's necessary to import the following libraries in a processing source if I want to use ArrayList objects with all its utilities (ex: iterator method, ecc) :

import.java.util.List*;
import.java.util.ArrayList*;
import.java.util.Collection*;
import.java.util.Iterator*;


thanks  Smiley
Re: Import question ????
Reply #1 - May 15th, 2010, 3:27am
 
Answer 1: the syntax you show isn't correct... Wink
Answer 2: just try (without them)... Smiley
Answer 3: I think it isn't necessary, Processing imports this package by default (IIRC).
Re: Import question ????
Reply #2 - May 15th, 2010, 3:39am
 
sorry for the shynthax errors;
i've checked that even if I import (correctly Smiley ) those libraries the line

ArrayList<Object> obj = new ArrayList<Object> ();

gives an error (for the tokens '>' and '<'), but I know this is the correct way to declare an ArrayList of the Object type in Java,
is there another way to do it in processing?? or simple you can't specify the object type ????
Re: Import question ????
Reply #3 - May 15th, 2010, 4:00am
 
Answer 1: In Processing 1.1, the Java 1.5 syntax isn't implemented, so you use it in the old way: ArrayList obj = new ArrayList();
Answer 2: If you feel adventurous (not so much, I use it and it is quite stable), you can download the latest version 0184 and use this syntax, as there is an experimental (ie. not fully tested, but the more people use it, the more tested it will be...) support of this syntax.
Re: Import question ????
Reply #4 - May 15th, 2010, 4:04am
 
ok thanks  Smiley
Page Index Toggle Pages: 1