public final class ArrayUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_STRING_DELIMITER |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
append(T[] input,
T addItem)
Adds the specified item to the input array and returns a new array instance with the length of the input array +1.
|
static <T> T[] |
arrayCopy(T[] original) |
static byte[] |
concat(byte[] first,
byte[] second)
Concatenates the two specified byte arrays to a new array.
|
static double[] |
concat(double[] first,
double[] second)
Concatenates the two specified double arrays to a new array.
|
static int[] |
concat(int[] first,
int[] second)
Concatenates the two specified int arrays to a new array.
|
static long[] |
concat(long[] first,
long[] second)
Concatenates the two specified long arrays to a new array.
|
static <T> T[] |
concat(T[] first,
T[] second)
Concatenates the two specified double arrays to a new array.
|
static boolean |
contains(java.lang.Object[] arr,
java.lang.Object value)
Return true if the array contains the specified value.
|
static boolean |
contains(java.lang.String[] arr,
java.lang.String argument,
boolean ignoreCase)
Return true if the array contains the specified string argument.
|
static <T> T[] |
distinct(T[] first,
T[] second)
Combines the two specified arrays by only keeping distinct values.
|
static java.lang.String |
join(boolean[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(boolean[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(byte[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(byte[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(java.util.Collection<?> collection)
Joins the specified list with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(java.util.Collection<?> collection,
java.lang.String delimiter)
Joins the specified collection with the defined delimiter.
|
static java.lang.String |
join(double[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(double[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(float[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(float[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(int[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(int[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(long[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(long[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(java.lang.Object[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(java.lang.Object[] arr,
java.lang.String delimiter)
Joins the specified array with the defined delimiter.
|
static java.lang.String |
join(short[] arr)
Joins the specified array with the
DEFAULT_STRING_DELIMITER . |
static java.lang.String |
join(short[] arr,
java.lang.String delimiter) |
static <T> T[] |
remove(T[] input,
T deleteItem)
Removes the specified deleteItem from the input array and returns a trimmed new array instance without null entries.
|
static double[] |
splitDouble(java.lang.String delimiterSeparatedString)
Splits the specified string by the
DEFAULT_STRING_DELIMITER into a double array. |
static double[] |
splitDouble(java.lang.String delimiterSeparatedString,
java.lang.String delimiter)
Splits the specified string by the defined delimiter into a double array.
|
static int[] |
splitInt(java.lang.String delimiterSeparatedString)
Splits the specified string by the
DEFAULT_STRING_DELIMITER into an int array. |
static int[] |
splitInt(java.lang.String delimiterSeparatedString,
java.lang.String delimiter)
Splits the specified string by the defined delimiter into an int array.
|
static int[] |
toIntegerArray(java.util.List<java.lang.Integer> intList) |
static <T> java.util.List<T> |
toList(T[][] arr) |
public static final java.lang.String DEFAULT_STRING_DELIMITER
public static byte[] concat(byte[] first, byte[] second)
first
- The first array.second
- The second array.public static int[] concat(int[] first, int[] second)
first
- The first array.second
- The second array.public static long[] concat(long[] first, long[] second)
first
- The first array.second
- The second array.public static double[] concat(double[] first, double[] second)
first
- The first array.second
- The second array.public static <T> T[] concat(T[] first, T[] second)
T
- The type of the array elements.first
- The first array.second
- The second array.public static int[] splitInt(java.lang.String delimiterSeparatedString)
DEFAULT_STRING_DELIMITER
into an int array.delimiterSeparatedString
- The string to split.public static int[] splitInt(java.lang.String delimiterSeparatedString, java.lang.String delimiter)
delimiterSeparatedString
- The string to split.delimiter
- The delimiter by which to split the elements.public static double[] splitDouble(java.lang.String delimiterSeparatedString)
DEFAULT_STRING_DELIMITER
into a double array.delimiterSeparatedString
- The string to split.public static double[] splitDouble(java.lang.String delimiterSeparatedString, java.lang.String delimiter)
delimiterSeparatedString
- The string to split.delimiter
- The delimiter by which to split the elements.public static java.lang.String join(boolean[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(boolean[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(int[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(int[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(double[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(double[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(float[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(float[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(short[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(short[] arr, java.lang.String delimiter)
public static java.lang.String join(long[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(long[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(byte[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(byte[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(java.util.Collection<?> collection)
DEFAULT_STRING_DELIMITER
.collection
- The list that provides the elements to be joined.public static java.lang.String join(java.util.Collection<?> collection, java.lang.String delimiter)
collection
- The list that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static java.lang.String join(java.lang.Object[] arr)
DEFAULT_STRING_DELIMITER
.arr
- The array that provides the elements to be joined.public static java.lang.String join(java.lang.Object[] arr, java.lang.String delimiter)
arr
- The array that provides the elements to be joined.delimiter
- The delimiter used to separate the elements with.public static <T> java.util.List<T> toList(T[][] arr)
public static boolean contains(java.lang.Object[] arr, java.lang.Object value)
arr
- The array that is tested for the existence of the element.value
- The element to check for in the array.public static boolean contains(java.lang.String[] arr, java.lang.String argument, boolean ignoreCase)
arr
- The array that is tested for the existence of the argument.argument
- The argument to check for in the array.ignoreCase
- A flag indicating whether the case should be ignored when checking for equality.public static <T> T[] remove(T[] input, T deleteItem)
T
- The element type of the array.input
- The original arraydeleteItem
- The item to deletepublic static <T> T[] append(T[] input, T addItem)
T
- The element type of the array.input
- The original array.addItem
- The item to add.public static <T> T[] distinct(T[] first, T[] second)
T
- The element type of the array.first
- The first array.second
- The second array.public static <T> T[] arrayCopy(T[] original)
public static int[] toIntegerArray(java.util.List<java.lang.Integer> intList)