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 › Linked lists in Processing
Page Index Toggle Pages: 1
Linked lists in Processing? (Read 799 times)
Linked lists in Processing?
Apr 18th, 2010, 12:28pm
 
Hi!

I was wondering if it is possible to make a linked-list like data structure in Processing (if you don't know what it is - check this, beware - awful background there Cheesy). I didn't find any struct operators, so I tried something like
Code:
class test {
   int somevalue;
   test *next-test;
}


But it wasn't working. I don't know Java, but after some googling it seems that it is possible to make linked lists there. Is it possible

I thought that linked lists would be a great way to make some L-system sketches.

Thanks in advance!
Re: Linked lists in Processing?
Reply #1 - Apr 18th, 2010, 12:59pm
 
There are of course some caveats, but since Processing is built on Java you can usually use Java directly in Processing.  E.g. it seems it's easy enough to create a LinkedList object:

Code:
LinkedList foo;

void setup() {
 size(100,100);
 foo = new LinkedList();
}
Re: Linked lists in Processing?
Reply #2 - Apr 18th, 2010, 2:06pm
 
I've come across this processing LSystem sketch http://garethspor.com/lsystems/lsystem.pde with what looks to me like a quick and dirty implementation of a linked list. It is a style of coding that did not appeal to me, and is definitely not necessary.
Page Index Toggle Pages: 1