Java examples for Collection Framework:HashSet
Get Enumeration over HashSet
import java.util.Enumeration; import java.util.HashSet; import java.util.Collections; public class Main { public static void main(String[] args) { HashSet hashSet = new HashSet(); //from w w w.j a va2 s .c o m hashSet.add("A"); hashSet.add("B"); hashSet.add("D"); hashSet.add("E"); hashSet.add("F"); Enumeration e = Collections.enumeration(hashSet); System.out.println("Enumerating through Java HashSet"); while(e.hasMoreElements()) System.out.println(e.nextElement()); } }