Android examples for java.lang:array union merge
merge String Arrays
import android.text.Html; import android.text.TextUtils; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main{ public static String[] mergeStringArrays(String array1[], String array2[]) {//from w ww. j ava 2 s. c om if (array1 == null || array1.length == 0) { return array2; } if (array2 == null || array2.length == 0) { return array1; } List<String> array1List = Arrays.asList(array1); List<String> array2List = Arrays.asList(array2); List<String> result = new ArrayList<String>(array1List); List<String> tmp = new ArrayList<String>(array1List); tmp.retainAll(array2List); result.addAll(array2List); return ((String[]) result.toArray(new String[result.size()])); } }