Java Array Concatenate concat(Object[] first, Object second)

Here you can find the source of concat(Object[] first, Object second)

Description

concat

License

Open Source License

Declaration

public static Object[] concat(Object[] first, Object second) 

Method Source Code


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

import java.util.Arrays;

public class Main {

    public static Object[] concat(Object[] first, Object second) {
        Object[] result = Arrays.copyOf(first, first.length + 1);
        System.arraycopy(new Object[] { second }, 0, result, first.length, 1);
        return result;
    }/*from   ww  w. j ava2 s.c o  m*/

    public static Object[] concat(Object[] first, Object... second) {
        Object[] result = new Object[first.length + second.length];
        System.arraycopy(first, 0, result, 0, first.length);
        System.arraycopy(second, 0, result, first.length, second.length);
        return result;
    }
}

Related

  1. concat(final T[] first, final T[] second)
  2. concat(float[] A, float[] B)
  3. concat(int[] first, int[] second)
  4. concat(int[]... arrays)
  5. concat(Object[] array)
  6. concat(String[] array, String separator)
  7. concat(String[] parts)
  8. concat(String[] strs)
  9. concat(String[]... arrays)