File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resize stack

 
Ryan William
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ryan William
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to resize an array when the array has reach it's max size.
Thanks.. for the reply Cindy!
 
John Smith
Ranch Hand
Posts: 2937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic