Java HashSet() Constructor
Syntax
HashSet() constructor from HashSet has the following syntax.
public HashSet()
Example
In the following code shows how to use HashSet.HashSet() constructor.
//from ww w . j a va 2s.c om
import java.util.HashSet;
public class Main{
public static void main(String args[]) {
HashSet<String> hs = new HashSet<String>();
System.out.println(hs.isEmpty());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »