Android Array Concatenate concat(T[] a, T[] b)

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

Description

concat

Declaration

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

Method Source Code

//package com.java2s;
import java.lang.reflect.Array;

public class Main {
    public static <T> T[] concat(T[] a, T[] b) {
        final int alen = a.length;
        final int blen = b.length;
        if (alen == 0) {
            return b;
        }//w  ww . j  a  v a2s  .com
        if (blen == 0) {
            return a;
        }
        final T[] result = (T[]) Array.newInstance(a.getClass()
                .getComponentType(), alen + blen);
        System.arraycopy(a, 0, result, 0, alen);
        System.arraycopy(b, 0, result, alen, blen);
        return result;
    }
}

Related

  1. concat(T[] first, T[]... rest)
  2. concat(byte[] first, byte[]... rest)
  3. cancat(byte[] a, byte[] b)
  4. arrayApend(byte[] prep, byte after)
  5. arrayComb(byte[] prep, byte[] after)
  6. concatAll(T[] first, T[]... rest)
  7. concatenate(byte[]... bytes)
  8. concat(T[] first, T[] second)
  9. concat(byte[] b1, byte[] b2)