Here you can find the source of removeDuplicates(List> listofthings)
Parameter | Description |
---|---|
listofthings | a parameter |
public static void removeDuplicates(List<?> listofthings)
//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); } } } }