Here you can find the source of addNoDuplicate(String[] array, String target)
public static String[] addNoDuplicate(String[] array, String target)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.List; public class Main { public static String[] addNoDuplicate(String[] array, String target) { List<String> list = Arrays.asList(array); if (!list.contains(target)) { list.add(target);/* ww w .j av a 2 s . c o m*/ } String[] result = list.toArray(new String[0]); return result; } }