Android Utililty Methods Array Create

List of utility methods to do Array Create

Description

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

Method

Object[]nullToEmpty(Object[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_OBJECT_ARRAY;
return array;
short[]nullToEmpty(short[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_SHORT_ARRAY;
return array;
String[]nullToEmpty(String[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_STRING_ARRAY;
return array;
boolean[]nullToEmpty(boolean[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_BOOLEAN_ARRAY;
return array;
byte[]nullToEmpty(byte[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_BYTE_ARRAY;
return array;
char[]nullToEmpty(char[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_CHAR_ARRAY;
return array;
double[]nullToEmpty(double[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_DOUBLE_ARRAY;
return array;
float[]nullToEmpty(float[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_FLOAT_ARRAY;
return array;
int[]nullToEmpty(int[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_INT_ARRAY;
return array;
long[]nullToEmpty(long[] array)

Defensive programming technique to change a null reference to an empty one.

This method returns an empty array for a null input array.

As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.

if (array == null || array.length == 0) {
    return EMPTY_LONG_ARRAY;
return array;