Have a Question?

If you have any question you can ask below or enter what you are looking for!

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]
    }
}

 

Tags:  , , , , , , , , ,

Leave a Reply

Your email address will not be published.