Android examples for java.lang:array union merge
Build an array from list of arrays
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; public class Main{ public static String[] buildArray(String[]... arrays) { int length = 0; for (String[] array : arrays) { length += array.length;//from www . ja va 2 s.c om } String[] newArray = new String[length]; int offset = 0; for (String[] array : arrays) { System.arraycopy(array, 0, newArray, offset, array.length); offset += array.length; } return newArray; } }