public class ArrayUtil extends Object
| Constructor and Description |
|---|
ArrayUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
add(byte[] array,
int size,
byte element)
Adds the given element to the given array.
|
static int[] |
add(int[] array,
int size,
int element)
Adds the given element to the given array.
|
static long[] |
add(long[] array,
int size,
long element)
Adds the given element to the given array.
|
static Object[] |
add(Object[] array,
int size,
Object element)
Adds the given element to the given array.
|
static short[] |
add(short[] array,
int size,
short element)
Adds the given element to the given array.
|
static int |
compare(byte[] array1,
int size1,
byte[] array2,
int size2)
Compares the elements of the two given arrays.
|
static int |
compare(Comparable[] array1,
int size1,
Comparable[] array2,
int size2)
Compares the elements of the two given arrays.
|
static int |
compare(int[] array1,
int size1,
int[] array2,
int size2)
Compares the elements of the two given arrays.
|
static int |
compare(short[] array1,
int size1,
short[] array2,
int size2)
Compares the elements of the two given arrays.
|
static boolean[] |
ensureArraySize(boolean[] array,
int size,
boolean initialValue)
Ensures the given array has a given size.
|
static byte[] |
ensureArraySize(byte[] array,
int size,
byte initialValue)
Ensures the given array has a given size.
|
static int[] |
ensureArraySize(int[] array,
int size,
int initialValue)
Ensures the given array has a given size.
|
static long[] |
ensureArraySize(long[] array,
int size,
long initialValue)
Ensures the given array has a given size.
|
static Object[] |
ensureArraySize(Object[] array,
int size,
Object initialValue)
Ensures the given array has a given size.
|
static short[] |
ensureArraySize(short[] array,
int size,
short initialValue)
Ensures the given array has a given size.
|
static boolean |
equal(byte[] array1,
byte[] array2,
int size)
Returns whether the elements of the two given arrays are the same.
|
static boolean |
equal(int[] array1,
int[] array2,
int size)
Returns whether the elements of the two given arrays are the same.
|
static boolean |
equal(Object[] array1,
Object[] array2,
int size)
Returns whether the elements of the two given arrays are the same.
|
static boolean |
equal(short[] array1,
short[] array2,
int size)
Returns whether the elements of the two given arrays are the same.
|
static boolean |
equalOrNull(Object[] array1,
Object[] array2)
Returns whether the elements of the two given arrays are the same, or
both arrays are null.
|
static boolean |
equalOrNull(Object[] array1,
Object[] array2,
int size)
Returns whether the elements of the two given arrays are the same, or
both arrays are null.
|
static boolean[] |
extendArray(boolean[] array,
int size)
Ensures the given array has a given size.
|
static byte[] |
extendArray(byte[] array,
int size)
Ensures the given array has a given size.
|
static int[] |
extendArray(int[] array,
int size)
Ensures the given array has a given size.
|
static long[] |
extendArray(long[] array,
int size)
Ensures the given array has a given size.
|
static Object[] |
extendArray(Object[] array,
int size)
Ensures the given array has a given size.
|
static short[] |
extendArray(short[] array,
int size)
Ensures the given array has a given size.
|
static int |
hashCode(byte[] array,
int size)
Returns a hash code for the elements of the given array.
|
static int |
hashCode(int[] array,
int size)
Returns a hash code for the elements of the given array.
|
static int |
hashCode(Object[] array,
int size)
Returns a hash code for the elements of the given array.
|
static int |
hashCode(short[] array,
int size)
Returns a hash code for the elements of the given array.
|
static int |
hashCodeOrNull(Object[] array)
Returns a hash code for the elements of the given array, or 0 if it is
null.
|
static int |
hashCodeOrNull(Object[] array,
int size)
Returns a hash code for the elements of the given array, or 0 if it is
null.
|
static byte[] |
insert(byte[] array,
int size,
int index,
byte element)
Inserts the given element in the given array.
|
static int[] |
insert(int[] array,
int size,
int index,
int element)
Inserts the given element in the given array.
|
static long[] |
insert(long[] array,
int size,
int index,
long element)
Inserts the given element in the given array.
|
static Object[] |
insert(Object[] array,
int size,
int index,
Object element)
Inserts the given element in the given array.
|
static short[] |
insert(short[] array,
int size,
int index,
short element)
Inserts the given element in the given array.
|
static void |
remove(byte[] array,
int size,
int index)
Removes the specified element from the given array.
|
static void |
remove(int[] array,
int size,
int index)
Removes the specified element from the given array.
|
static void |
remove(long[] array,
int size,
int index)
Removes the specified element from the given array.
|
static void |
remove(Object[] array,
int size,
int index)
Removes the specified element from the given array.
|
static void |
remove(short[] array,
int size,
int index)
Removes the specified element from the given array.
|
public static boolean equal(byte[] array1,
byte[] array2,
int size)
array1 - the first array.array2 - the second array.size - the size of the arrays to be checked.public static boolean equal(short[] array1,
short[] array2,
int size)
array1 - the first array.array2 - the second array.size - the size of the arrays to be checked.public static boolean equal(int[] array1,
int[] array2,
int size)
array1 - the first array.array2 - the second array.size - the size of the arrays to be checked.public static boolean equal(Object[] array1, Object[] array2, int size)
array1 - the first array.array2 - the second array.size - the size of the arrays to be checked.public static boolean equalOrNull(Object[] array1, Object[] array2)
array1 - the first array.array2 - the second array.public static boolean equalOrNull(Object[] array1, Object[] array2, int size)
array1 - the first array.array2 - the second array.size - the size of the arrays to be checked.public static int hashCode(byte[] array,
int size)
array - the array.size - the size of the array to be taken into account.public static int hashCode(short[] array,
int size)
array - the array.size - the size of the array to be taken into account.public static int hashCode(int[] array,
int size)
array - the array.size - the size of the array to be taken into account.public static int hashCode(Object[] array, int size)
array - the array.size - the size of the array to be taken into account.public static int hashCodeOrNull(Object[] array)
array - the array.public static int hashCodeOrNull(Object[] array, int size)
array - the array.size - the size of the array to be taken into account.public static int compare(byte[] array1,
int size1,
byte[] array2,
int size2)
array1 - the first array.size1 - the size of the first array.array2 - the second array.size2 - the size of the second array.public static int compare(short[] array1,
int size1,
short[] array2,
int size2)
array1 - the first array.size1 - the size of the first array.array2 - the second array.size2 - the size of the second array.public static int compare(int[] array1,
int size1,
int[] array2,
int size2)
array1 - the first array.size1 - the size of the first array.array2 - the second array.size2 - the size of the second array.public static int compare(Comparable[] array1, int size1, Comparable[] array2, int size2)
array1 - the first array.size1 - the size of the first array.array2 - the second array.size2 - the size of the second array.public static boolean[] extendArray(boolean[] array,
int size)
array - the array.size - the target size of the array.public static boolean[] ensureArraySize(boolean[] array,
int size,
boolean initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.public static byte[] add(byte[] array,
int size,
byte element)
array - the array.size - the original size of the array.element - the element to be added.public static byte[] insert(byte[] array,
int size,
int index,
byte element)
array - the array.size - the original size of the array.index - the index at which the element is to be added.element - the element to be added.public static void remove(byte[] array,
int size,
int index)
array - the array.size - the original size of the array.index - the index of the element to be removed.public static byte[] extendArray(byte[] array,
int size)
array - the array.size - the target size of the array.public static byte[] ensureArraySize(byte[] array,
int size,
byte initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.public static short[] add(short[] array,
int size,
short element)
array - the array.size - the original size of the array.element - the element to be added.public static short[] insert(short[] array,
int size,
int index,
short element)
array - the array.size - the original size of the array.index - the index at which the element is to be added.element - the element to be added.public static void remove(short[] array,
int size,
int index)
array - the array.size - the original size of the array.index - the index of the element to be removed.public static short[] extendArray(short[] array,
int size)
array - the array.size - the target size of the array.public static short[] ensureArraySize(short[] array,
int size,
short initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.public static int[] add(int[] array,
int size,
int element)
array - the array.size - the original size of the array.element - the element to be added.public static int[] insert(int[] array,
int size,
int index,
int element)
array - the array.size - the original size of the array.index - the index at which the element is to be added.element - the element to be added.public static void remove(int[] array,
int size,
int index)
array - the array.size - the original size of the array.index - the index of the element to be removed.public static int[] extendArray(int[] array,
int size)
array - the array.size - the target size of the array.public static int[] ensureArraySize(int[] array,
int size,
int initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.public static long[] add(long[] array,
int size,
long element)
array - the array.size - the original size of the array.element - the element to be added.public static long[] insert(long[] array,
int size,
int index,
long element)
array - the array.size - the original size of the array.index - the index at which the element is to be added.element - the element to be added.public static void remove(long[] array,
int size,
int index)
array - the array.size - the original size of the array.index - the index of the element to be removed.public static long[] extendArray(long[] array,
int size)
array - the array.size - the target size of the array.public static long[] ensureArraySize(long[] array,
int size,
long initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.public static Object[] add(Object[] array, int size, Object element)
array - the array.size - the original size of the array.element - the element to be added.public static Object[] insert(Object[] array, int size, int index, Object element)
array - the array.size - the original size of the array.index - the index at which the element is to be added.element - the element to be added.public static void remove(Object[] array, int size, int index)
array - the array.size - the original size of the array.index - the index of the element to be removed.public static Object[] extendArray(Object[] array, int size)
array - the array.size - the target size of the array.public static Object[] ensureArraySize(Object[] array, int size, Object initialValue)
array - the array.size - the target size of the array.initialValue - the initial value of the elements.Copyright © 2015. All Rights Reserved.