Generic method to concatenate two arrays - Android java.lang

Android examples for java.lang:Array Element

Description

Generic method to concatenate two arrays

Demo Code


//package com.java2s;
import java.util.Arrays;

public class Main {
    public static <T> T[] concat(T[] first, T[] second) {
        T[] result = Arrays.copyOf(first, first.length + second.length);
        System.arraycopy(second, 0, result, first.length, second.length);
        return result;
    }/*from   w w  w .ja v a  2s.c om*/
}

Related Tutorials