Java Array Merge merge(String[]... arrays)

Here you can find the source of merge(String[]... arrays)

Description

merge

License

Apache License

Declaration

public static String[] merge(String[]... arrays) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Main {

    public static String[] merge(String[]... arrays) {
        if (arrays == null) {
            throw new IllegalArgumentException("argument must not be null.");
        }//w  w  w  . ja  va 2  s  .  c  o  m
        List<String> result = new ArrayList<String>();
        for (String[] array : arrays) {
            Collections.addAll(result, array);
        }
        return toArray(result);
    }

    public static String[] toArray(Collection<String> collection) {
        if (collection == null) {
            throw new IllegalArgumentException("argument must not be null.");
        }
        return collection.toArray(new String[collection.size()]);
    }
}

Related

  1. merge(String array[], String delimiter)
  2. merge(String[] array)
  3. merge(String[] array1, String[] array2)
  4. merge(String[] strArr1, String[] strArr2)
  5. merge(String[] strArray)
  6. merge(T[] array, T[] temp, int left, int middle, int right)
  7. merge(T[] array1, T[] array2)
  8. merge(T[] first, T[] second)
  9. merge(T[] first, T[] second)