Java Utililty Methods Array Merge

List of utility methods to do Array Merge

Description

The list of methods to do Array Merge are organized into topic(s).

Method

String[]mergeStringArrays(String[][] arrayOfArrays)
Merges an array of string arrays to a concatenated string array.
if (arrayOfArrays == null) {
    return new String[0];
ArrayList<String> res = new ArrayList<String>();
for (int i = 0; i < arrayOfArrays.length; i++) {
    if (arrayOfArrays[i] == null) {
        continue;
    for (int j = 0; j < arrayOfArrays[i].length; j++) {
        if (arrayOfArrays[i][j] != null) {
            res.add(arrayOfArrays[i][j]);
return res.toArray(new String[res.size()]);
String[]mergeStrings(String[] x, String[] y)
merge Strings
if (x == null)
    return y;
if (y == null)
    return x;
List<String> mergedList = new ArrayList<String>();
int xp = 0, yp = 0;
while (xp < x.length && yp < y.length) {
    if (x[xp].compareTo(y[yp]) < 0) {
...
ArrayListmergeToArray(T... args)
merge To Array
ArrayList<T> out = new ArrayList<T>();
out.addAll(Arrays.asList(args));
return out;