List of utility methods to do Array Create
T[] | emptyArray(Class Returns an empty array of the specified type. if (kind == Object.class) { return (T[]) EMPTY; int bucket = ((System.identityHashCode(kind) / 8) & 0x7FFFFFFF) % CACHE_SIZE; Object cache = sCache[bucket]; if (cache == null || cache.getClass().getComponentType() != kind) { cache = Array.newInstance(kind, 0); ... |
T[] | emptyArray(Class Returns an empty array of the specified type. if (kind == Object.class) { return (T[]) EMPTY; int bucket = ((System.identityHashCode(kind) / 8) & 0x7FFFFFFF) % CACHE_SIZE; Object cache = sCache[bucket]; if (cache == null || cache.getClass().getComponentType() != kind) { cache = Array.newInstance(kind, 0); ... |
T[] | emptyArray(Class empty Array if (kind == Object.class) { return (T[]) EMPTY; int bucket = (System.identityHashCode(kind) / 8 & 0x7FFFFFFF) % CACHE_SIZE; Object cache = sCache[bucket]; if (cache == null || cache.getClass().getComponentType() != kind) { cache = Array.newInstance(kind, 0); ... |
boolean[] | nullToEmpty(boolean[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_BOOLEAN_ARRAY; return array; |
byte[] | nullToEmpty(byte[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_BYTE_ARRAY; return array; |
Character[] | nullToEmpty(Character[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_CHARACTER_OBJECT_ARRAY; return array; |
double[] | nullToEmpty(double[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_DOUBLE_ARRAY; return array; |
float[] | nullToEmpty(float[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_FLOAT_ARRAY; return array; |
Integer[] | nullToEmpty(Integer[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_INTEGER_OBJECT_ARRAY; return array; |
long[] | nullToEmpty(long[] array) Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty if (array == null || array.length == 0) { return EMPTY_LONG_ARRAY; return array; |