Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static <T> void uniqAdd(Collection<T> collection, T elements) { if (collection == null) return; if (!collection.contains(elements)) collection.add(elements); } }