List of utility methods to do Array Expand
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; |
Object | expand(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; |
Object | expand(Object obj, int size) expand return expand(obj, size, true);
|
Object | expand(Object obj, int size, boolean flag, Class> class1) expand if (obj == null) { return Array.newInstance(class1, 1); } else { return expand(obj, size, flag); |