com.evanmclean.evlib.lang
Class Arr

java.lang.Object
  extended by com.evanmclean.evlib.lang.Arr

public final class Arr
extends Object

Misc functions for various array related operations.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Method Summary
static boolean[] arr(boolean... args)
          Returns a variable number of arguments as an array.
static byte[] arr(byte... args)
          Returns a variable number of arguments as an array.
static char[] arr(char... args)
          Returns a variable number of arguments as an array.
static double[] arr(double... args)
          Returns a variable number of arguments as an array.
static float[] arr(float... args)
          Returns a variable number of arguments as an array.
static int[] arr(int... args)
          Returns a variable number of arguments as an array.
static long[] arr(long... args)
          Returns a variable number of arguments as an array.
static short[] arr(short... args)
          Returns a variable number of arguments as an array.
static
<T> T[]
arr(T... args)
          Returns a variable number of arguments as an array.
static boolean isEmpty(boolean[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(byte[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(char[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(double[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(float[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(int[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(long[] arr)
          Return true if the array is of zero length or null;
static boolean isEmpty(short[] arr)
          Return true if the array is of zero length or null;
static
<T> boolean
isEmpty(T[] arr)
          Return true if the array is of zero length or null;
static boolean isNotEmpty(boolean[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(byte[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(char[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(double[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(float[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(int[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(long[] arr)
          Return true if the array is not null and not of zero length.
static boolean isNotEmpty(short[] arr)
          Return true if the array is not null and not of zero length.
static
<T> boolean
isNotEmpty(T[] arr)
          Return true if the array is not null and not of zero length.
static int length(boolean[] arr)
          Return the length of the array (zero for null).
static int length(byte[] arr)
          Return the length of the array (zero for null).
static int length(char[] arr)
          Return the length of the array (zero for null).
static int length(double[] arr)
          Return the length of the array (zero for null).
static int length(float[] arr)
          Return the length of the array (zero for null).
static int length(int[] arr)
          Return the length of the array (zero for null).
static int length(long[] arr)
          Return the length of the array (zero for null).
static int length(short[] arr)
          Return the length of the array (zero for null).
static
<T> int
length(T[] arr)
          Return the length of the array (zero for null).
static boolean[] nullIfEmpty(boolean[] arr)
          Return the array if is not null and not empty (zero length).
static byte[] nullIfEmpty(byte[] arr)
          Return the array if is not null and not empty (zero length).
static char[] nullIfEmpty(char[] arr)
          Return the array if is not null and not empty (zero length).
static double[] nullIfEmpty(double[] arr)
          Return the array if is not null and not empty (zero length).
static float[] nullIfEmpty(float[] arr)
          Return the array if is not null and not empty (zero length).
static int[] nullIfEmpty(int[] arr)
          Return the array if is not null and not empty (zero length).
static long[] nullIfEmpty(long[] arr)
          Return the array if is not null and not empty (zero length).
static short[] nullIfEmpty(short[] arr)
          Return the array if is not null and not empty (zero length).
static
<T> T[]
nullIfEmpty(T[] arr)
          Return the array if is not null and not empty (zero length).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

arr

public static boolean[] arr(boolean... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static byte[] arr(byte... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static char[] arr(char... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static double[] arr(double... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static float[] arr(float... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static int[] arr(int... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static long[] arr(long... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static short[] arr(short... args)
Returns a variable number of arguments as an array.

Parameters:
args - The values to return as an array.
Returns:
An array of the arguments.

arr

public static <T> T[] arr(T... args)
Returns a variable number of arguments as an array.

Type Parameters:
T - Type of arguments array to return.
Parameters:
args - The objects to return as an array.
Returns:
An array of the arguments.

isEmpty

public static boolean isEmpty(boolean[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(byte[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(char[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(double[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(float[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(int[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(long[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static boolean isEmpty(short[] arr)
Return true if the array is of zero length or null;

Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isEmpty

public static <T> boolean isEmpty(T[] arr)
Return true if the array is of zero length or null;

Type Parameters:
T -
Parameters:
arr -
Returns:
Return true if the array is of zero length or null.

isNotEmpty

public static boolean isNotEmpty(boolean[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(byte[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(char[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(double[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(float[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(int[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(long[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static boolean isNotEmpty(short[] arr)
Return true if the array is not null and not of zero length.

Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

isNotEmpty

public static <T> boolean isNotEmpty(T[] arr)
Return true if the array is not null and not of zero length.

Type Parameters:
T -
Parameters:
arr -
Returns:
Return true if the array is not null and not of zero length.

length

public static int length(boolean[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(byte[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(char[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(double[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(float[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(int[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(long[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static int length(short[] arr)
Return the length of the array (zero for null).

Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

length

public static <T> int length(T[] arr)
Return the length of the array (zero for null).

Type Parameters:
T -
Parameters:
arr -
Returns:
Return the length of the array, or zero of arr is null.

nullIfEmpty

public static boolean[] nullIfEmpty(boolean[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static byte[] nullIfEmpty(byte[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static char[] nullIfEmpty(char[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static double[] nullIfEmpty(double[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static float[] nullIfEmpty(float[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static int[] nullIfEmpty(int[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static long[] nullIfEmpty(long[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static short[] nullIfEmpty(short[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.

nullIfEmpty

public static <T> T[] nullIfEmpty(T[] arr)
Return the array if is not null and not empty (zero length).

Parameters:
arr -
Returns:
Returns the array if it is not empty, otherwise null.