T - element typepublic abstract class ObjectArrayFunctions<T> extends java.lang.Object implements ArrayFunctions<T[]>
| Constructor and Description |
|---|
ObjectArrayFunctions(java.lang.Class<T> cls) |
| Modifier and Type | Method and Description |
|---|---|
T[] |
concat(T[] array1,
T[] array2)
Concatenates two arrays into one and returns it.
|
void |
copyArray(T[] from,
int fromOffset,
T[] to,
int toOffset,
int length)
Copies part of the first array to the second array.
|
T[] |
copyOfRange(T[] original,
int from,
int to)
Copies the specified range.
|
boolean |
endsWith(T[] array,
T[] subarray)
Checks if
array[length - subarray.length:] == subarray. |
boolean |
equals(T[] array1,
int array1Index,
T[] array2,
int array2Index)
Checks if
array1[array1Index] == array2[array2Index]. |
boolean |
equals(T[] array1,
T[] array2)
Checks if the two arrays have the same content.
|
int |
getCommonPrefixLength(T[] array1,
T[] array2)
Determines the longest common prefix, that is, the number of items at
the start of the arrays that are equal.
|
int |
getCommonSuffixLength(T[] array1,
T[] array2)
Determines the longest common suffix, that is, the number of items at
the end of the arrays that are equal.
|
int |
getLength(T[] value)
Gets the length of the given array.
|
T[] |
newArray(int length)
Constructs a new array of the given length.
|
boolean |
startsWith(T[] array,
T[] subarray)
Checks if
array[:subarray.length] == subarray. |
public ObjectArrayFunctions(java.lang.Class<T> cls)
public T[] newArray(int length)
ArrayFunctionsnewArray in interface ArrayFunctions<T[]>length - array lengthpublic int getLength(T[] value)
ArrayFunctionsgetLength in interface ArrayFunctions<T[]>value - array valuepublic boolean equals(T[] array1, T[] array2)
ArrayFunctionsequals in interface ArrayFunctions<T[]>array1 - first arrayarray2 - second arraypublic T[] concat(T[] array1, T[] array2)
ArrayFunctionsconcat in interface ArrayFunctions<T[]>array1 - first arrayarray2 - second arraypublic boolean startsWith(T[] array, T[] subarray)
ArrayFunctionsarray[:subarray.length] == subarray.startsWith in interface ArrayFunctions<T[]>array - array to checksubarray - array prefix to check forpublic boolean endsWith(T[] array, T[] subarray)
ArrayFunctionsarray[length - subarray.length:] == subarray.endsWith in interface ArrayFunctions<T[]>array - array to checksubarray - array suffix to check forpublic int getCommonSuffixLength(T[] array1, T[] array2)
ArrayFunctionsgetCommonSuffixLength in interface ArrayFunctions<T[]>array1 - first arrayarray2 - second arraypublic int getCommonPrefixLength(T[] array1, T[] array2)
ArrayFunctionsgetCommonPrefixLength in interface ArrayFunctions<T[]>array1 - first arrayarray2 - second arraypublic T[] copyOfRange(T[] original, int from, int to)
ArrayFunctionscopyOfRange in interface ArrayFunctions<T[]>original - array to copy fromfrom - range start indexto - range end indexpublic void copyArray(T[] from, int fromOffset, T[] to, int toOffset, int length)
ArrayFunctionscopyArray in interface ArrayFunctions<T[]>from - array to copy fromfromOffset - offset to copy fromto - array to copy tcotoOffset - offset to copy tolength - number of items to copypublic boolean equals(T[] array1, int array1Index, T[] array2, int array2Index)
ArrayFunctionsarray1[array1Index] == array2[array2Index].equals in interface ArrayFunctions<T[]>array1 - first arrayarray1Index - first array indexarray2 - second arrayarray2Index - second array index