Here you can find the source of removeDublicates(List
public static <T> void removeDublicates(List<T> l)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public class Main { public static <T> void removeDublicates(List<T> l) { 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();// ww w. j a v a 2 s .c o m } } } }