Android Utililty Methods Array Expand

List of utility methods to do Array Expand

Description

The list of methods to do Array Expand are organized into topic(s).

Method

T[]arrayexpend(T[] array, int increment)
arrayexpend
System.arraycopy(
        array,
        0,
        array = (T[]) Array.newInstance(array.getClass()
                .getComponentType(), array.length + increment), 0,
        array.length - increment);
return array;
T[]ensureLength(T[] original, int capacity)
ensure Length
if (original.length < capacity) {
    original = Arrays.copyOf(original, capacity);
return original;
Objectexpand(Object obj, int i, boolean flag)
expand
int j = Array.getLength(obj);
Object obj1 = Array.newInstance(obj.getClass().getComponentType(),
        j + i);
System.arraycopy(obj, 0, obj1, flag ? 0 : i, j);
return obj1;
Objectexpand(Object obj, int size)
expand
return expand(obj, size, true);
Objectexpand(Object obj, int size, boolean flag, Class class1)
expand
if (obj == null) {
    return Array.newInstance(class1, 1);
} else {
    return expand(obj, size, flag);