Speed: Array lookup vs field lookup

I have particles in my particle simulator referred to by array lookups - would it be faster to 'chain' the particles by including a 'next' field in each particle instance that links to the next particle in the chain, and refer to that field when moving through the particles?
[286 byte] By [_Komodo_a] at [2007-10-2 16:50:05]
# 1

> I have particles in my particle simulator referred to

> by array lookups - would it be faster to 'chain' the

> particles by including a 'next' field in each

> particle instance that links to the next particle in

> the chain, and refer to that field when moving

> through the particles?

so basically you're asking whether iterating a linked list is faster than iterating an array. I guess the array will be an unmeasurable amout of time faster since there'll be no additionalmethod call.

If you really want to know, do both and test.

CeciNEstPasUnProgrammeura at 2007-7-13 18:01:37 > top of Java-index,Java Essentials,Java Programming...
# 2
Hmm, ok thanks a lot for the information. Is it reallyequivalent to having a linked list then, if I loop through the fields in a group of instances?
_Komodo_a at 2007-7-13 18:01:37 > top of Java-index,Java Essentials,Java Programming...
# 3
> Hmm, ok thanks a lot for the information. Is it> reallyequivalent to having a linked list then, if I> loop through the fields in a group of instances?What do you think a linked list does?
CeciNEstPasUnProgrammeura at 2007-7-13 18:01:37 > top of Java-index,Java Essentials,Java Programming...
# 4
Huh, so it essentially assigns the objects within it a new field 'next' and thus allows you to iterate over the collection? Interesting.
_Komodo_a at 2007-7-13 18:01:37 > top of Java-index,Java Essentials,Java Programming...