Android Array Expand arrayexpend(T[] array, int increment)

Here you can find the source of arrayexpend(T[] array, int increment)

Description

arrayexpend

Declaration

@SuppressWarnings("unchecked")
    public static <T> T[] arrayexpend(T[] array, int increment) 

Method Source Code

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

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> T[] arrayexpend(T[] array, int increment) {
        System.arraycopy(/* ww w . j  a va2 s .  c  o  m*/
                array,
                0,
                array = (T[]) Array.newInstance(array.getClass()
                        .getComponentType(), array.length + increment), 0,
                array.length - increment);
        return array;
    }
}

Related

  1. ensureLength(T[] original, int capacity)
  2. expand(Object obj, int i, boolean flag)
  3. expand(Object obj, int size)
  4. expand(Object obj, int size, boolean flag, Class class1)