HashSet in Java and what is FillRatio or LoadFactor?
Fill Ratio or LoadFactorÂ
- After filling how much ratio a new HashSet object will be created, this ratio is called FillRatio or LoadFactor.
- For example, fill ratio 0.75 means after filling 75% ratio a new HashSet object will be created.
package com.java4us; import java.util.HashSet; public class Test { public static void main(String[] args) { HashSet set = new HashSet(); set.add("Raja"); set.add("Rani"); set.add("Test"); set.add("Java"); System.out.println(set); //[Java, Test, Raja, Rani] } }