Java Array Concatenate concat(T[] array1, T[] array2)

Here you can find the source of concat(T[] array1, T[] array2)

Description

concat

License

Open Source License

Declaration

public static <T> T[] concat(T[] array1, T[] array2) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static <T> T[] concat(T[] array1, T[] array2) {
        T[] newarray = Arrays.copyOf(array1, array1.length + array2.length);

        for (int i = 0; i < array2.length; i++) {
            newarray[array1.length + i] = array2[i];
        }//from   w  w  w .  j a va  2 s  .c  o m
        return newarray;
    }
}

Related

  1. concat(T val, T[] vals)
  2. concat(T[] a, T[] b)
  3. concat(T[] a, T[] b, T[] c, T[] d)
  4. concat(T[] arr0, @SuppressWarnings("unchecked") T[]... more)
  5. concat(T[] array, Collection collection)
  6. concat(T[] array1, T[] array2)
  7. concat(T[] first, @SuppressWarnings("unchecked") T... second)
  8. concat(T[] first, T[] second)
  9. concat(T[] first, T[] second)