Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays 1

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Hi,
I have an array like

xxxx[] x;
x = new xxxx[10];

How can I enlarge this array when I find it too small? I wand to do it without it's data to be removed. Ion Filipski
1c.bmp


filipski@excite.com
 
If you are looking to change the size of your array, I would suggest that an array is not what you should be using.

Arrays by there very nature are static length data types, they are not designed to change size. I would suggest using either Vector() (if you are using threads, since it is thread safe - but very slow), or an ArrayList() (faster, but not thread safe)

Both work in a manner very similar to an Array but the added benefits of the java.util.List interface (iterators etc.) and both are dynamic. -------------------------------------------
There are no onions, only magic
-------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top