public final class Arrays2
extends java.lang.Object
Arrays provides.| Modifier and Type | Method | Description |
|---|---|---|
static <E> E[] |
compactNulls(E[] original) |
Create a new array from the original which contains no
null values, possibly destroying the
contents of the original array. |
static <E> E[] |
createArray(java.lang.Class<E> elementType,
int size) |
Create an array of the given size, ensuring type safety.
|
static boolean |
equals(byte[] a1,
int offs1,
byte[] a2) |
Compare two sub-regions of the given arrays.
|
static boolean |
equals(byte[] a1,
int offs1,
byte[] a2,
int offs2,
int len) |
Compare two sub-regions of the given arrays.
|
static boolean |
equals(char[] a1,
int offs1,
char[] a2) |
Compare two sub-regions of the given arrays.
|
static boolean |
equals(char[] a1,
int offs1,
char[] a2,
int offs2,
int len) |
Compare two sub-regions of the given arrays.
|
static boolean |
equals(char[] a1,
int offs1,
java.lang.String a2) |
Compare two sub-regions of the given array and string.
|
static boolean |
equals(char[] a1,
int offs1,
java.lang.String a2,
int offs2,
int len) |
Compare two sub-regions of the given array and string.
|
static boolean |
equals(java.lang.String a1,
char[] a2) |
Compare the given array and string.
|
static boolean |
equals(java.lang.String a1,
int offs1,
char[] a2) |
Compare two sub-regions of the given array and string.
|
static int |
indexOf(byte[] array,
int search) |
Find the first occurrence of a byte in a byte array.
|
static int |
indexOf(byte[] array,
int search,
int offs) |
Find the first occurrence of a byte in a byte array.
|
static int |
indexOf(byte[] array,
int search,
int offs,
int len) |
Find the first occurrence of a byte in a byte array.
|
static java.lang.String |
objectToString(java.lang.Object value) |
Deeply convert an object to a string, expanding arrays as they are encountered.
|
static <T> T[] |
of(T... items) |
Return the varargs list as its array representation.
|
static java.lang.String |
toString(byte[] bytes) |
Render the given byte array as a hexadecimal string in big-endian order.
|
public static boolean equals(byte[] a1,
int offs1,
byte[] a2,
int offs2,
int len)
a1 - the first array (must not be null)offs1 - the offset into the first arraya2 - the second array (must not be null)offs2 - the offset into the second arraylen - the length to comparetrue if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for an arraypublic static boolean equals(byte[] a1,
int offs1,
byte[] a2)
a1 - the first array (must not be null)offs1 - the offset into the first arraya2 - the second array (must not be null)true if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for an arraypublic static boolean equals(char[] a1,
int offs1,
char[] a2,
int offs2,
int len)
a1 - the first array (must not be null)offs1 - the offset into the first arraya2 - the second array (must not be null)offs2 - the offset into the second arraylen - the length to comparetrue if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for an arraypublic static boolean equals(char[] a1,
int offs1,
char[] a2)
a1 - the first array (must not be null)offs1 - the offset into the first arraya2 - the second array (must not be null)true if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for an arraypublic static boolean equals(char[] a1,
int offs1,
java.lang.String a2,
int offs2,
int len)
a1 - the array (must not be null)offs1 - the offset into the arraya2 - the string (must not be null)offs2 - the offset into the stringlen - the length to comparetrue if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for the array or stringpublic static boolean equals(char[] a1,
int offs1,
java.lang.String a2)
a1 - the array (must not be null)offs1 - the offset into the arraya2 - the string (must not be null)true if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for the array or stringpublic static boolean equals(java.lang.String a1,
int offs1,
char[] a2)
a1 - the string (must not be null)offs1 - the offset into the stringa2 - the array (must not be null)true if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for the array or stringpublic static boolean equals(java.lang.String a1,
char[] a2)
a1 - the string (must not be null)a2 - the array (must not be null)true if the regions are equal, or false if the regions are not equal or a length or offset
is out of bounds for the array or string@SafeVarargs public static <T> T[] of(T... items)
T - the item typeitems - the itemspublic static java.lang.String toString(byte[] bytes)
bytes - the byte array (must not be null)public static int indexOf(byte[] array,
int search,
int offs,
int len)
array - the array to searchsearch - the byte to search foroffs - the offset in the array to start searchinglen - the length of the segment to searchpublic static int indexOf(byte[] array,
int search,
int offs)
array - the array to searchsearch - the byte to search foroffs - the offset in the array to start searchingpublic static int indexOf(byte[] array,
int search)
array - the array to searchsearch - the byte to search forpublic static <E> E[] createArray(java.lang.Class<E> elementType,
int size)
E - the element typeelementType - the element type classsize - the array sizepublic static <E> E[] compactNulls(E[] original)
null values, possibly destroying the
contents of the original array. If the original contains no null values, the original array is returned.E - the element typeoriginal - the original array (not null, will be modified)public static java.lang.String objectToString(java.lang.Object value)
value - the value to convertCopyright © 2018 JBoss, a division of Red Hat, Inc.