Java List Remove Duplicate removeDuplicates(List listofthings)

Here you can find the source of removeDuplicates(List listofthings)

Description

Function removeDuplicates ------------------------- This function removes duplicate entries from a list.

License

Open Source License

Parameter

Parameter Description
listofthings a parameter

Declaration

public static void removeDuplicates(List<?> listofthings) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**//from w  w w  . j a  v  a 2s . c  om
     * Function removeDuplicates
     * -------------------------
     * This function removes duplicate entries from a list. 
     * @param listofthings
     */
    public static void removeDuplicates(List<?> listofthings) {
        for (int i = listofthings.size() - 1; i > 0; i--) {
            if (listofthings.get(i).equals(listofthings.get(i - 1))) {
                listofthings.remove(i);
            }
        }
    }
}

Related

  1. removeDuplicate(Collection entityList)
  2. removeDuplicate(List uidList)
  3. removeDuplicate(List dest, List src)
  4. removeDuplicates(int[] list)
  5. removeDuplicates(List list)
  6. removeDuplicates(List commonVars)
  7. removeDuplicates(List l)
  8. removeDuplicates(List collection)
  9. removeDuplicates(List list)