Java Array Concatenate arrayConcat(T[] a, T[] b)

Here you can find the source of arrayConcat(T[] a, T[] b)

Description

array Concat

License

Open Source License

Declaration

public static <T> T[] arrayConcat(T[] a, T[] b) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static <T> T[] arrayConcat(T[] a, T[] b) {
        if (a == null)
            throw new IllegalArgumentException("'a' can't be null");
        if (b == null)
            throw new IllegalArgumentException("'b' can't be null");
        T[] rn = Arrays.copyOf(a, a.length + b.length);
        System.arraycopy(b, 0, rn, a.length, b.length);
        T[] r = rn;/*from w w w  . ja  va 2 s. c  o  m*/
        return r;
    }
}

Related

  1. arraycat(String[][] array1, String[][] array2)
  2. arrayConcat(byte[] a, byte[] b)
  3. arrayConcat(final byte[] firstArray, final byte[] secondArray)
  4. arrayConcat(String[] first, String second)
  5. arrayConcat(T[] first, T[] second)
  6. arrayConcat(T[] first, T[] second)
  7. arrayConcatenate(final String[] f, final String[] s)
  8. arrayConcatenate(String[] first, String[] second)