Here you can find the source of addUnique(List
static public <T> void addUnique(List<T> list, T item)
//package com.java2s; import java.util.List; public class Main { static public <T> void addUnique(List<T> list, T item) { if (isInList(list, item) == null) { list.add(item);//w ww.jav a2 s. c o m } } static public <T> T isInList(List<T> list, T item) { for (T elm : list) { if (elm.equals(item)) { return elm; } } return null; } }