public static String[] mergeStringArrays(String[] array1,String[] array2){
  if (ObjectUtils.isEmpty(array1)) {
    return array2;
  }
  if (ObjectUtils.isEmpty(array2)) {
    return array1;
  }
  List<String> result=new ArrayList<String>();
  result.addAll(Arrays.asList(array1));
  for (  String str : array2) {
    if (!result.contains(str)) {
      result.add(str);
    }
  }
  return toStringArray(result);
}

public static String [ ] mergeStringArrays ( String [ ] array1 , String [ ] array2 ) { if ( ObjectUtils . isEmpty ( array1 ) ) { return array2 ; } if ( ObjectUtils . isEmpty ( array2 ) ) { return array1 ; } List < String > result = new ArrayList < String > ( ) ; result . addAll ( Arrays . asList ( array1 ) ) ; for ( String str : array2 ) { if ( ! result . contains ( str ) ) { result . add ( str ) ; } } return toStringArray ( result ) ; }
merge the given string arrays into one , with overlapping array elements only included once . < p > the order of elements in the original arrays is preserved ( with the exception of overlapping elements , which are only included on their first occurrence ) .
