| 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
|
|
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]
|
 |
 |
|
|
subject: ArrayList Vs Vector & HashMap Vs HashTable - Interms of Allocation sizes.
|
|
|