Iterate through elements of Java LinkedHashSet : LinkedHashSet « Collections « Java Tutorial






import java.util.Iterator;
import java.util.LinkedHashSet;

public class Main {
  public static void main(String[] args) {
    LinkedHashSet<Integer> lhashSet = new LinkedHashSet<Integer>();

    lhashSet.add(new Integer("1"));
    lhashSet.add(new Integer("2"));
    lhashSet.add(new Integer("3"));

    Iterator itr = lhashSet.iterator();

    while (itr.hasNext()){
      System.out.println(itr.next());
    }
  }
}








9.20.LinkedHashSet
9.20.1.Putting your own type in a LinkedHashSet
9.20.2.Get Size of Java LinkedHashSet
9.20.3.Iterate through elements of Java LinkedHashSet
9.20.4.Remove all elements from Java LinkedHashSet
9.20.5.Remove specified element from Java LinkedHashSet