Java Utililty Methods List Remove Duplicate

List of utility methods to do List Remove Duplicate

Description

The list of methods to do List Remove Duplicate are organized into topic(s).

Method

voidremoveDublicates(List l)
remove Dublicates
final Set<T> set = new HashSet<T>();
for (Iterator<T> it = l.iterator(); it.hasNext();) {
    final T t = it.next();
    if (!set.add(t)) {
        it.remove();
ListremoveDup(List lst)
remove Dup
final List<T> l = new ArrayList<>();
for (T t : lst) {
    if (!l.contains(t))
        l.add(t);
return l;
ListremoveDuplicate(Collection entityList)
Remueve los entities que estan duplicados en la coleccion pasada como parametro Para comparar si los entities estan repetidos se usara su metodo equals
Set set = new HashSet(entityList);
return Arrays.asList(set.toArray());
ListremoveDuplicate(List uidList)
Remove duplicates in a list of rooms
HashSet<String> uidSet = new HashSet<String>();
uidSet.addAll(uidList);
return new ArrayList<String>(uidSet);
voidremoveDuplicate(List dest, List src)
remove Duplicate
if (dest == null) {
    return;
if (src == null || src.isEmpty()) {
    return;
int capacity = dest.size() > src.size() ? dest.size() : src.size();
HashMap<T, Integer> map = new HashMap<T, Integer>(capacity);
...
int[]removeDuplicates(int[] list)
Removes dupicated entries from the list.
if (list == null || list.length == 0) {
    return new int[0];
Hashtable<Integer, Boolean> tbl = new Hashtable<Integer, Boolean>(list.length);
for (int ele : list) {
    tbl.put(ele, Boolean.FALSE);
int[] result = new int[tbl.size()];
...
voidremoveDuplicates(List list)
remove Duplicates
if ((list != null) && !list.isEmpty()) {
    Set set = new HashSet(list.size());
    for (Iterator iter = list.iterator(); iter.hasNext();) {
        Object element = iter.next();
        if (set.contains(element)) {
            iter.remove();
        } else {
            set.add(element);
...
voidremoveDuplicates(List listofthings)
Function removeDuplicates ------------------------- This function removes duplicate entries from a list.
for (int i = listofthings.size() - 1; i > 0; i--) {
    if (listofthings.get(i).equals(listofthings.get(i - 1))) {
        listofthings.remove(i);
ListremoveDuplicates(List commonVars)
removes duplicated vars in a list
List<String> sList = new ArrayList<String>();
for (String s : commonVars) {
    if (sList.contains(s)) {
    } else {
        sList.add(s);
return sList;
...
ListremoveDuplicates(List l)
Remove duplicates preserving original order.
List<String> res = new ArrayList<String>();
for (Iterator<String> iter = l.iterator(); iter.hasNext();) {
    String element = iter.next();
    if (!res.contains(element)) {
        res.add(element);
return res;
...