Java tutorial
//package com.java2s; import java.util.*; public class Main { public static <T> List<T> removeDuplicate(List<T> list) { Set set = new HashSet(); List newList = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { Object element = iter.next(); if (set.add(element)) newList.add(element); } return newList; } }