Android Array Add arrayappend(T[] array, T[] append)

Here you can find the source of arrayappend(T[] array, T[] append)

Description

arrayappend

Declaration

public static <T> T[] arrayappend(T[] array, T[] append) 

Method Source Code

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

public class Main {
    public static <T> T[] arrayappend(T[] array, T[] append) {
        return arrayappend(array, append, append.length);
    }//from   www.j  av a  2  s  .  c o  m

    public static <T> T[] arrayappend(T[] array, T[] append, int size) {
        array = arrayexpend(array, size);
        System.arraycopy(append, 0, array, array.length - size, size);
        return array;
    }

    @SuppressWarnings("unchecked")
    public static <T> T[] arrayexpend(T[] array, int increment) {
        System.arraycopy(
                array,
                0,
                array = (T[]) Array.newInstance(array.getClass()
                        .getComponentType(), array.length + increment), 0,
                array.length - increment);
        return array;
    }
}

Related

  1. addAll(long[] array1, long... array2)
  2. addAll(short[] array1, short... array2)
  3. append(String[] original, String element)
  4. appendElement(Class kind, T[] array, T element)
  5. appendInt(int[] cur, int val)
  6. arrayappend(T[] array, T[] append, int size)
  7. arraybyteappend(byte[] array, byte[] append)
  8. arraybyteappend(byte[] array, byte[] append, int size)
  9. arrayintappend(int[] array, int[] append)