List of usage examples for java.util HashSet HashSet
public HashSet()
From source file:Main.java
public static <K> HashSet<K> newHashSet() { return new HashSet(); }
From source file:Main.java
public static <T> Set<T> toSet(T... arr) { Set<T> set = new HashSet<T>(); for (T t : arr) set.add(t);//from ww w. j a va2s .c o m return set; }
From source file:Main.java
public static <T> Set<T> clone(Set<T> set) { Set<T> newSet = new HashSet<>(); set.forEach(newSet::add);/*from w w w . ja v a 2 s .c om*/ return newSet; }
From source file:Main.java
public static <T> HashSet<T> newHashSet() { return new HashSet<T>(); }
From source file:Main.java
public static <T> Set<T> emptySet() { return new HashSet<T>(); }
From source file:Main.java
public static <E> Set<E> newHashSet() { return new HashSet<E>(); }
From source file:Main.java
public static <T> HashSet<T> createHashSet() { return new HashSet(); }
From source file:Main.java
public static <T> List<T> removeDuplicate(List<T> list) { Set set = new HashSet(); List newList = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { Object element = iter.next(); if (set.add(element)) newList.add(element);/*from w w w . j a v a2 s .co m*/ } return newList; }
From source file:Main.java
public static <T> Set<T> immutableSet(T element) { Set<T> immutableSet = new HashSet<T>(); immutableSet.add(element);//from ww w . ja v a2 s .c o m return immutableSet(immutableSet); }
From source file:Main.java
public static <E> HashSet<E> newHashSet() { return new HashSet<>(); }