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.
Page Index Toggle Pages: 1
ArrayList issue (Read 384 times)
ArrayList issue
Nov 25th, 2007, 7:40pm
 
For this (normal, valid java code):

ArrayList foo = new ArrayList();
for (int i=0; i<100; i++)
{
 foo.add(i);
}

i get following compilation error:

Semantic Error: No applicable overload for a method with signature "add(int)" was found in type "java.util.ArrayList". Perhaps you wanted the overloaded version "boolean add(java.lang.Object $1);" instead?

How in the world can i fill the arrayList with integers?
Re: ArrayList issue
Reply #1 - Nov 25th, 2007, 7:44pm
 
You need to convert from int to Integer (The Object version of int)

Code:
foo.add(new Integer(i)); 

Page Index Toggle Pages: 1