File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes resize stack Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "resize stack" Watch "resize stack" New topic
Author

resize stack

Ryan William
Greenhorn

Joined: Sep 18, 2003
Posts: 2
I need examples of source code that uses resizing method. I was told to look in the Java library or java.util.vector for example source code but I haven't a clue for where to look for that. Any help would be appreciated!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Resizing as in GUI painting stuff? Or resizing as in Collections changing size?
Also zZRyanzZz,
I give you full credit for an interesting first name , however it does NOT look very real :roll: , so could you please drop the creative z's?
You can change your display name: here.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Ryan William
Greenhorn

Joined: Sep 18, 2003
Posts: 2
I need to resize an array when the array has reach it's max size.
Thanks.. for the reply Cindy!
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
I need to resize an array when the array has reach it's max size.
The standard solution is to use one of the implementations of the List interface (such as LinkedList and ArrayList). The resizing is automatic, and you get a number of additional bonuses to manipulate your collections and to make your code more reusable.
Jason Davies
Greenhorn

Joined: Sep 18, 2003
Posts: 14
As above, you may as well use java.util.ArrayList or java.util.Vector to handle automatic resizing.
If you want an example of resizing an array manually, here it is:

System.arraycopy() should always used for speed in cases like these. If you look at the source code for java.util.ArrayList I'm sure you'll find something very similar.


<a href="http://www.netspade.com/" target="_blank" rel="nofollow">http://www.netspade.com/</a> - Web programming articles and tutorials.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resize stack
 
Similar Threads
How are session IDs generated?
regarding cross-browser functionality or compatibility?
Chinese Input
Stack Trace question
Externalizable interface