Java Array Merge MergeArrays(T[]... arrs)

Here you can find the source of MergeArrays(T[]... arrs)

Description

Merge Arrays

License

Open Source License

Declaration

public static <T> T[] MergeArrays(T[]... arrs) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static <T> T[] MergeArrays(T[]... arrs) {
        ArrayList<T> list = new ArrayList<T>();
        for (T[] arr : arrs) {
            for (T t : arr) {
                list.add(t);//  w w  w  . ja  va  2  s .c  o m
            }
        }
        list.trimToSize();
        return list.toArray(arrs[0]);
    }
}

Related

  1. mergeArrays(String[] array, String[] newEntries)
  2. mergeArrays(String[] data1, String[] data2)
  3. mergeArrays(String[] inputArray1, String[] inputArray2)
  4. mergeArrays(T[] items, T[]... added)
  5. mergeArrays(T[] lhs, T[] rhs)
  6. mergeArrayToString(final String[] array)
  7. mergeByArray(int[] a, int[] b)
  8. mergeByteArraies(byte[] array1, byte[] array2)
  9. mergeByteArrays(byte[] array1, byte[] array2)