Java examples for Collection Framework:LinkedHashSet
Remove all elements from LinkedHashSet
import java.util.LinkedHashSet; public class Main { public static void main(String[] args) { LinkedHashSet lhashSet = new LinkedHashSet(); //from w ww . ja va2s. co m lhashSet.add(new Integer("1")); lhashSet.add(new Integer("2")); lhashSet.add(new Integer("3")); System.out.println("LinkedHashSet before removal : " + lhashSet); lhashSet.clear(); System.out.println("LinkedHashSet after removal : " + lhashSet); System.out.println("Is LinkedHashSet empty ? " + lhashSet.isEmpty()); } }