Here you can find the source of addUnique(java.util.List
public static void addUnique(java.util.List<String> l, String e)
//package com.java2s; /**// w w w . j a v a 2s . c o m * Utilities.java * --------------------------------- * Copyright (c) 2014 * RESOLVE Software Research Group * School of Computing * Clemson University * All rights reserved. * --------------------------------- * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ public class Main { public static void addUnique(java.util.List<String> l, String e) { if (!l.contains(e)) { l.add(e); } } }