Java Array Merge mergeArrays(T[] lhs, T[] rhs)

Here you can find the source of mergeArrays(T[] lhs, T[] rhs)

Description

merge Arrays

License

Open Source License

Declaration

public static <T> T[] mergeArrays(T[] lhs, T[] rhs) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static <T> T[] mergeArrays(T[] lhs, T[] rhs) {
        T[] newArray = Arrays.copyOf(lhs, lhs.length + rhs.length);
        for (int i = lhs.length; i < rhs.length; ++i) {
            newArray[i] = rhs[i - lhs.length];
        }//from w  w w . j a  v a 2 s.com

        return newArray;
    }
}

Related

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