Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How does ArrayList increase its capacity?

arraylist increase
0
Posted

How does ArrayList increase its capacity?

0

Location: http://www.jguru.com/faq/view.jsp?EID=333358 Created: Feb 19, 2001 Modified: 2001-02-19 13:32:49.494 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) Unlike Vector where you can specify a capacity increment, ArrayList doesn’t support this. Instead, ArrayList will increase capacity by about a half when it runs out of space. The refernece implementation uses the forumla: newCapacity = (oldCapacity * 3)/2 + 1 though, this isn’t part of the class definition so others can implement it differently.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.