• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
UdayK Kumar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!