Here you can find the source of removeRepeat(List
public static <T> List<T> removeRepeat(List<T> list) throws Exception
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> removeRepeat(List<T> list) throws Exception { Map<Integer, T> map = new HashMap<Integer, T>(); if (list == null) return null; for (T t : list) { if (t == null) continue; map.put(t.hashCode(), t);/*from w w w.jav a 2 s . com*/ } try { list.clear(); list.addAll(map.values()); } catch (Exception e) { } return new ArrayList<T>(map.values()); } }