Android Utililty Methods List Duplicate Remove

List of utility methods to do List Duplicate Remove

Description

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

Method

voidremoveDuplicates(List list)
remove Duplicates
for (int i = 0; i < list.size(); i++) {
    int j = i + 1;
    while (j < list.size()) {
        if (list.get(i).equals(list.get(j))) {
            list.remove(j);
        } else {
            j++;
voidremoveDuplicates(List list, Comparator comparator)
Sorts and removes duplicate elements from list .
Collections.sort(list, comparator);
int j = 1;
for (int i = 1; i < list.size(); i++) {
    if (comparator.compare(list.get(j - 1), list.get(i)) != 0) {
        T object = list.get(i);
        list.set(j++, object);
if (j < list.size()) {
    list.subList(j, list.size()).clear();