A - array type (such as int[], String[], ...)public interface ArrayFunctions<A>
| Modifier and Type | Method and Description |
|---|---|
A |
concat(A array1,
A array2)
Concatenates two arrays into one and returns it.
|
void |
copyArray(A from,
int fromOffset,
A to,
int toOffset,
int length)
Copies part of the first array to the second array.
|
A |
copyOfRange(A original,
int from,
int to)
Copies the specified range.
|
boolean |
endsWith(A array,
A subarray)
Checks if
array[length - subarray.length:] == subarray. |
boolean |
equals(A array1,
A array2)
Checks if the two arrays have the same content.
|
boolean |
equals(A array1,
int array1Index,
A array2,
int array2Index)
Checks if
array1[array1Index] == array2[array2Index]. |
int |
getCommonPrefixLength(A array1,
A array2)
Determines the longest common prefix, that is, the number of items at
the start of the arrays that are equal.
|
int |
getCommonSuffixLength(A array1,
A array2)
Determines the longest common suffix, that is, the number of items at
the end of the arrays that are equal.
|
int |
getLength(A value)
Gets the length of the given array.
|
A |
newArray(int length)
Constructs a new array of the given length.
|
A |
read(BytesDataInput input)
Reads an array from the given input stream.
|
A |
read(DataInput input)
Reads an array from the given input stream.
|
A |
readRaw(BytesDataInput input,
int length)
Reads an array from the given input stream.
|
A |
readRaw(DataInput input,
int length)
Reads an array from the given input stream.
|
boolean |
startsWith(A array,
A subarray)
Checks if
array[:subarray.length] == subarray. |
void |
write(BytesDataOutput output,
A value)
Writes the contents of the given array to the output stream.
|
void |
write(DataOutput output,
A value)
Writes the contents of the given array to the output stream.
|
void |
writeRaw(BytesDataOutput output,
A value)
Writes the contents of the given array to the output stream.
|
void |
writeRaw(DataOutput output,
A value)
Writes the contents of the given array to the output stream.
|
A newArray(int length)
length - array lengthint getLength(A value)
value - array valueboolean equals(A array1, A array2)
array1 - first arrayarray2 - second arrayboolean startsWith(A array, A subarray)
array[:subarray.length] == subarray.array - array to checksubarray - array prefix to check forboolean endsWith(A array, A subarray)
array[length - subarray.length:] == subarray.array - array to checksubarray - array suffix to check forint getCommonSuffixLength(A array1, A array2)
array1 - first arrayarray2 - second arrayint getCommonPrefixLength(A array1, A array2)
array1 - first arrayarray2 - second arrayA copyOfRange(A original, int from, int to)
original - array to copy fromfrom - range start indexto - range end indexvoid copyArray(A from, int fromOffset, A to, int toOffset, int length)
from - array to copy fromfromOffset - offset to copy fromto - array to copy tcotoOffset - offset to copy tolength - number of items to copyboolean equals(A array1, int array1Index, A array2, int array2Index)
array1[array1Index] == array2[array2Index].array1 - first arrayarray1Index - first array indexarray2 - second arrayarray2Index - second array indexA concat(A array1, A array2)
array1 - first arrayarray2 - second arrayvoid write(DataOutput output, A value) throws java.io.IOException
output - stream to write tovalue - array to be writtenjava.io.IOException - if an I/O error occursvoid writeRaw(DataOutput output, A value) throws java.io.IOException
output - stream to write tovalue - array to be writtenjava.io.IOException - if an I/O error occursvoid write(BytesDataOutput output, A value)
output - stream to write tovalue - array to be writtenvoid writeRaw(BytesDataOutput output, A value)
output - stream to write tovalue - array to be writtenA read(DataInput input) throws java.io.IOException
input - stream to read fromjava.io.IOException - if an I/O error occursA readRaw(DataInput input, int length) throws java.io.IOException
input - stream to read fromlength - array lengthjava.io.IOException - if an I/O error occursA read(BytesDataInput input)
input - stream to read fromA readRaw(BytesDataInput input, int length)
input - stream to read fromlength - array length