Array size, how to trim?
in
Programming Questions
•
3 years ago
Hi,
I want to use an array instead of an ArrayList, but I'm not sure if I got the manual right. Is it right that I must define the arrays number of elements in advance?
In the case of my script I know the maximum number of possible elements that could emerge. But I'm not sure if they will. So is it possible to set an arrays size to the maximum number of possible elements and if the array is not filled completly to trim it down to it's real size?
( Or: How can I resize an array on runtime? )
Thanks!
leerraum
I want to use an array instead of an ArrayList, but I'm not sure if I got the manual right. Is it right that I must define the arrays number of elements in advance?
In the case of my script I know the maximum number of possible elements that could emerge. But I'm not sure if they will. So is it possible to set an arrays size to the maximum number of possible elements and if the array is not filled completly to trim it down to it's real size?
( Or: How can I resize an array on runtime? )
Thanks!
leerraum
1