Here you can find the source of removeDup(List
public static <T> List<T> removeDup(List<T> lst)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> removeDup(List<T> lst) { final List<T> l = new ArrayList<>(); for (T t : lst) { if (!l.contains(t)) l.add(t);//from ww w .ja v a 2s .c o m } return l; } }