• Post Reply Bookmark Topic Watch Topic
  • New Topic

HashSet initial capacity to zero  RSS feed

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if we set initial capacity to zero, like below, what will happen ? is it an empty Set ? why we need set it to zero ?

Thanks.

 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The source code is available in the jdk... just unzip the src.zip file in the root directory of the jdk.

If you look at the source, you will see that if you set the initial capacity to zero, that the capacity that the HashSet starts with, is not zero.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!