This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes." Watch "ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes." New topic
Author

ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes.

UdayK Kumar
Greenhorn

Joined: Aug 05, 2009
Posts: 26

Hi,

Could you please anyone can give me the differences between ArrayList Vs Vector & HashMap Vs HashTable-- Interms of Allocation sizes.

1. What are the difault sizes and if we add one more extra element then how much size will be increased?


William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
Since the source code for the entire library is easy to find, you can study those classes to any degree of detail you desire and make up your own mind on the memory consumption.

Bill

Java Resources at www.wbrogden.com
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 348

The default sizes,

1. ArrayList - 10
2. Vector - 10
3. Hashtable - 11

On adding extra elements ArrayList gets incremented by (oldCapacity * 3)/2 + 1 and vector by oldCapacity * 2 and hastable by oldCapacity * 2 + 1.

Ananth Chellathurai [Walk on software]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes.
 
Similar Threads
Vector and hashtable inTiger
Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable
Hashmap vs hashtable ....
ArrayList and Vector
Vector Vs. Hashtable