Here you can find the source of mergeNoDuplicates(String[] in1, String[] in2)
public static String[] mergeNoDuplicates(String[] in1, String[] in2)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String[] mergeNoDuplicates(String[] in1, String[] in2) { Set holder = new HashSet(); if (in1 != null) { for (int i = 0; i < in1.length; i++) { holder.add(in1[i]);/*from w w w .j a v a 2 s. c o m*/ } } if (in2 != null) { for (int i = 0; i < in2.length; i++) { holder.add(in2[i]); } } return (collectionToStringArray(holder)); } /**{ method @name collectionToStringArray @function return an array of strings from a collection @param holder - non-null collection holding strings @return non-null array of strings }*/ public static String[] collectionToStringArray(Collection holder) { String[] ret = new String[holder.size()]; holder.toArray(ret); return (ret); } }