List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:Main.java
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")); System.out.println(lhashSet); }
From source file:Main.java
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")); LinkedHashSet<Integer> lhashSet2 = new LinkedHashSet<Integer>(lhashSet); }
From source file:Main.java
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")); System.out.println(lhashSet.contains(new Integer("3"))); }
From source file:Main.java
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")); Object[] objArray = lhashSet.toArray(); for (Object inte : objArray) { System.out.println(inte); }//w ww .ja va2 s .co m }
From source file:Main.java
public static void main(String[] args) { Set<String> s1 = new LinkedHashSet<>(); s1.add("A");//from w w w. j a va 2 s.co m s1.add("B"); s1.add("C"); s1.add("D"); System.out.println("LinkedHashSet: " + s1); }
From source file:Main.java
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")); System.out.println(lhashSet); boolean blnRemoved = lhashSet.remove(new Integer("2")); System.out.println(blnRemoved); System.out.println(lhashSet); }
From source file:Main.java
public static void main(String[] args) { LinkedHashSet<Integer> lhashSet = new LinkedHashSet<Integer>(); System.out.println("Size of LinkedHashSet : " + lhashSet.size()); lhashSet.add(new Integer("1")); lhashSet.add(new Integer("2")); lhashSet.add(new Integer("3")); System.out.println(lhashSet.size()); lhashSet.remove(new Integer("1")); System.out.println(lhashSet.size()); }
From source file:Main.java
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")); System.out.println(lhashSet); lhashSet.clear();/* w ww . jav a2s . c o m*/ System.out.println(lhashSet); System.out.println(lhashSet.isEmpty()); }
From source file:Main.java
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()); }//w w w . j av a 2s.c om }
From source file:Main.java
public static void main(String[] args) { Set<Integer> intSet = new LinkedHashSet<Integer>(); Random r = new Random(); while (intSet.size() <= 6) { intSet.add(r.nextInt(49));// w w w . j a va 2 s . co m } System.out.println(intSet); }