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 › check for belonging to ArrayList
Page Index Toggle Pages: 1
check for belonging to ArrayList (Read 452 times)
check for belonging to ArrayList
May 12th, 2009, 2:26pm
 
is there a way to check if an object is a member of a given ArrayList? I am looking for a way that does not cycle through every item in the list to see if there is an equivalency....does something like that exist?
Re: check for belonging to ArrayList
Reply #1 - May 12th, 2009, 2:56pm
 
Not without cycling.
both 'contains()' and 'indexOf()' internally check each item.

A HashMap is probably closer to what you are looking for.
Page Index Toggle Pages: 1