Java tutorial
import java.util.HashSet; public class Main { public static void main(String[] args) { HashSet<Integer> hSet = new HashSet<Integer>(); System.out.println("Size of HashSet : " + hSet.size()); hSet.add(new Integer("1")); hSet.add(new Integer("2")); hSet.add(new Integer("3")); System.out.println(hSet.size()); hSet.remove(new Integer("1")); System.out.println(hSet.size()); } } /* Size of HashSet : 0 3 2 */