Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
HashSet initial capacity to zero
Edward Chen
Ranch Hand
Posts: 798
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
Set<MyObject> myObjects = new HashSet<MyObject>(0);
Henry Wong
author
Posts: 23951
142
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Books:
Java Threads, 3rd Edition
,
Jini in a Nutshell
, and
Java Gems (contributor)
You've gotta fight it! Don't give in! Read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
about Hashset
Nested Set?
Logic when calling jsp page from same jsp page
Which principle(s) in Collection (HashSet) am I violating ?
how to prevent vector to be with 10 elements as defult ?
More...