• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explination for the below code

 
Srinivas Karthik
Greenhorn
Posts: 28
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the above code..
we have
private Set<StockDailyRecord> stockDailyRecords = new HashSet<StockDailyRecord>(0);

Why is the (0) after the declaration. what does that 0 do..
and why do we write it there.. I am dealing with a project currently .. I have similar code over there..can anyone explain me this please.
 
Bogdan Baraila
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find here: http://docs.oracle.com/javase/6/docs/api/java/util/HashSet.html the HashSet class documentation. Just look at the constructions of the HashSet and you will undestand:
HashSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor (0.75).
 
Anurag Verma
Ranch Hand
Posts: 168
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the initial capacity that will be allocated to the map.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic