Posted By:
Mike_Friedrich
Posted On:
Monday, April 22, 2002 03:01 AM
Hi, this depends on your needs.
The simple array is not thread-save. But it should be the fastest (if you have fixed small lengths). Generaly you should try to avoid unnecessarily copies of arrays.
You can try this too (if this match your needs):
strClvClienteEspecial.addItem(new Structure1(45));
strClvClienteEspecial.addItem(new Structure1(28));
strClvClienteEspecial.addItem(new Structure1(17));
You only need to add a constructor and
toString() method.
If you need the Collection interface, you can use:
class ArrayList (not thread-save / not synchronized)
class Vector (thread-save / synchronized)
or any other of the Collection classes.
And i think you have a bug in your code,
here you destroy the reference to the array:
est1= Structure1[1].setData(45);
est1= Structure1[2].setData(28);
est1= Structure1[3].setData(17);
And you get a ArrayOutOfBoundsException.
Something like:
est1[0].setData(45);
est1[1].setData(28);
est1[2].setData(17);
is better.