1import java.util.HashSet;
2public class HashSetSizeMethodExample
3{
4 public static void main(String[] args)
5 {
6 HashSet<String> hs = new HashSet<String>();
7 hs.add("Welcome");
8 hs.add("hello");
9 hs.add("world");
10 hs.add("core");
11 hs.add("java");
12 System.out.println("HashSet values: " + hs);
13 System.out.println("The size of HashSet is: " + hs.size());
14 }
15}