Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Capacity increase in ArrayList  RSS feed

 
Alex Teslin
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to find what is the size by which the ArrayList grows when it becomes full on JDK1.5? As far as i know they vary from jdk to jdk. It must be either 1.5 or 2 times but not sure. I checked the API and this information is abscent.

Thank you
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the Java 1.5 code for ensureCapacity

ensureCapacity is the method that enlarges the array when needed.
The full source for Java 1.5 sdk is about 63mb in 6,565 files - if you have the disk space, it is great to be able to find stuff like this.
Bill
 
Alex Teslin
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!