Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.List; public class Main { static public <T> void unique(List<T> list) { HashSet<T> h = new HashSet<T>(); for (T i : list) { h.add(i); } list.clear(); for (T i : h) { list.add(i); } } }