Java List Add Unique addUnique(java.util.List l, String e)

Here you can find the source of addUnique(java.util.List l, String e)

Description

add Unique

License

Open Source License

Declaration

public static void addUnique(java.util.List<String> l, String e) 

Method Source Code

//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);
        }
    }
}

Related

  1. addUniq(List list, Object object)
  2. addUnique(List aList, T anObj)
  3. addUnique(List list, T item)
  4. addUnique(List list, T item)
  5. addUniqueId(List aList, T anObj)

  6. HOME | Copyright © www.java2s.com 2016