FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   C++ style Dynamic Data question
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: C++ style Dynamic Data question  (Read 264 times)
Orca


C++ style Dynamic Data question
« on: Nov 28th, 2004, 6:16am »

Hi, I love processing, but I'm a C++ programmer who has very little Java experience.
 
If I don't know how many instances of an object I'll need at run time, or I need to randomly remove instances from a container, what's the best approach to take in Java/Processing?  I'm used to being able to solve this kind of problem with a linked list, but that's obviously a very C++ style solution...
 
Thanks, and sorry about the newbie question!
 
v3ga

WWW Email
Re: C++ style Dynamic Data question
« Reply #1 on: Nov 28th, 2004, 5:22pm »

Hello Orca,
 take a look at the Vector class : http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html
 
Happy coding !
 

http://v3ga.net
Orca


Re: C++ style Dynamic Data question
« Reply #2 on: Nov 28th, 2004, 7:51pm »

Hey, thanks!
 
cello

marcello3d WWW
Re: C++ style Dynamic Data question
« Reply #3 on: Nov 28th, 2004, 8:00pm »

You can make a linked list in java.
 
Code:

class Node {
  Node next = null;
  int data;
}

 
Objects in java are by reference, so it's not terribly different from using pointers in c++.
 
Marcello
 
Pages: 1 

« Previous topic | Next topic »