Java Array Join join(T[] arr1, T[] arr2)

Here you can find the source of join(T[] arr1, T[] arr2)

Description

join

License

Open Source License

Declaration

public static <T> T[] join(T[] arr1, T[] arr2) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {

    public static <T> T[] join(T[] arr1, T[] arr2) {
        if (arr1 == null || arr1.length == 0) {
            return arr2;
        }/*from   www .  j  a va2s  . c om*/
        if (arr2 == null || arr2.length == 0) {
            return arr1;
        }
        T[] newArrays = (T[]) Arrays.copyOf(arr1, arr1.length + arr2.length, arr1.getClass());

        System.arraycopy(arr2, 0, newArrays, arr1.length, arr2.length);

        return newArrays;
    }
}

Related

  1. join(String[] tokens, String separator)
  2. join(String[] x)
  3. join(String[]... arrays)
  4. join(String[]... values)
  5. join(T[] a, T[] b)
  6. join(T[] array, String join)
  7. join(T[] array, String separator)
  8. join(T[] array, String separator)
  9. join(T[] array, String separator)