public final class ArrayUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
add(T[] a,
Collection<T> toAdd)
Create a new array with new elements appended at the end.
|
static <T> T[] |
add(T[] a,
T elem)
Create a new array with one more element appended at the end.
|
static <T> T[] |
add(T[] a,
T elem,
int pos)
Create a new array with one more element inserted at the given position.
|
static int |
compare(byte[] b1,
byte[] b2)
Compare 2 byte arrays.
|
static int |
compare(byte[] b1,
int off1,
byte[] b2,
int off2,
int len)
Compare 2 byte arrays.
|
static <T> T[] |
concatenate(T[] a,
T[] b)
Create a new array concatenating first array with second array.
|
static boolean |
contains(byte[] array,
byte value)
Return true if the array contains the value.
|
static boolean |
contains(char[] array,
char value)
Return true if the array contains the value.
|
static boolean |
contains(int[] array,
int value)
Return true if the array contains the value.
|
static boolean |
contains(long[] array,
long value)
Return true if the array contains the value.
|
static boolean |
contains(short[] array,
short value)
Return true if the array contains the value.
|
static <T> boolean |
contains(T[] array,
T value)
Return true if the array contains the value.
|
static byte[] |
copy(byte[] a)
Create a copy of the array.
|
static <T> T[] |
createGenericArray(Class<T[]> clazz,
int size)
Creates an array of the given type and size.
|
static <T> T[] |
createGenericArray(Class<T[]> clazz,
Object[] content)
Creates an array of the given type, and put the given elements inside.
|
static <T> T[] |
createGenericArrayOf(int size,
Class<T> type)
Creates an array of the given type and size.
|
static boolean |
equals(byte[] a1,
byte[] a2)
Return true if the 2 arrays are identical.
|
static boolean |
equals(byte[] a1,
int off1,
byte[] a2,
int off2,
int len)
Return true if the 2 specified parts of the arrays are identical.
|
static boolean |
equals(char[] a1,
char[] a2)
Return true if the 2 arrays are identical.
|
static boolean |
equals(char[] a1,
int off1,
char[] a2,
int off2,
int len)
Return true if the 2 specified parts of the arrays are identical.
|
static boolean |
equals(int[] a1,
int[] a2)
Return true if the 2 arrays are identical.
|
static boolean |
equals(int[] a1,
int off1,
int[] a2,
int off2,
int len)
Return true if the 2 specified parts of the arrays are identical.
|
static boolean |
equals(long[] a1,
int off1,
long[] a2,
int off2,
int len)
Return true if the 2 specified parts of the arrays are identical.
|
static boolean |
equals(long[] a1,
long[] a2)
Return true if the 2 arrays are identical.
|
static boolean |
equals(short[] a1,
int off1,
short[] a2,
int off2,
int len)
Return true if the 2 specified parts of the arrays are identical.
|
static boolean |
equals(short[] a1,
short[] a2)
Return true if the 2 arrays are identical.
|
static <T> boolean |
equals(T[] a1,
int off1,
T[] a2,
int off2,
int len)
Return true if the portions of the arrays are equal.
|
static <T> boolean |
equals(T[] a1,
T[] a2)
Return true if the 2 arrays are identical.
|
static int |
indexOf(byte element,
byte[] array)
Return the index of the element in the array, or -1 if not found.
|
static int |
indexOf(char element,
char[] array)
Return the index of the element in the array, or -1 if not found.
|
static int |
indexOf(int element,
int[] array)
Return the index of the element in the array, or -1 if not found.
|
static int |
indexOf(long element,
long[] array)
Return the index of the element in the array, or -1 if not found.
|
static int |
indexOf(short element,
short[] array)
Return the index of the element in the array, or -1 if not found.
|
static <T> int |
indexOf(T element,
T[] array)
Return the index of the element in the array, or -1 if not found.
|
static <T> int |
indexOfInstance(T element,
T[] array)
Return the index of the element in the array, or -1 if not found.
|
static <T> List<T> |
intersectionIdentity(T[] a1,
T[] a2)
Creates a List containing instances of elements present in both arrays.
|
static <T> Iterator<T> |
iterator(T[] a)
Instantiate an ArrayIterator on the given array.
|
static byte[] |
merge(List<byte[]> arrays)
Create a single byte array from the given arrays.
|
static <T> ArrayList<T> |
newArrayList(T[] items)
Create an ArrayList from the array.
|
static <T> T[] |
remove(T[] a,
T elem)
Remove an element from an array.
|
static <T> T[] |
removeAt(T[] a,
int i)
Create a new array with the element at the given position removed from it.
|
static int |
search(byte[] toFind,
byte[] array)
Search a sequence of bytes.
|
static int |
search(byte[] toFind,
byte[] array,
int start)
Search a sequence of bytes.
|
static int |
search(byte[] toFind,
byte[] array,
int start,
int len)
Search a sequence of bytes.
|
static int[] |
toArray(Collection<Integer> col)
Create an array from the collection.
|
public static <T> boolean contains(T[] array,
T value)
public static boolean contains(char[] array,
char value)
public static boolean contains(byte[] array,
byte value)
public static boolean contains(short[] array,
short value)
public static boolean contains(int[] array,
int value)
public static boolean contains(long[] array,
long value)
public static <T> int indexOf(T element,
T[] array)
public static int indexOf(byte element,
byte[] array)
public static int indexOf(short element,
short[] array)
public static int indexOf(int element,
int[] array)
public static int indexOf(long element,
long[] array)
public static int indexOf(char element,
char[] array)
public static <T> int indexOfInstance(T element,
T[] array)
public static <T> boolean equals(T[] a1,
T[] a2)
public static <T> boolean equals(T[] a1,
int off1,
T[] a2,
int off2,
int len)
public static boolean equals(byte[] a1,
byte[] a2)
public static boolean equals(byte[] a1,
int off1,
byte[] a2,
int off2,
int len)
public static boolean equals(short[] a1,
short[] a2)
public static boolean equals(short[] a1,
int off1,
short[] a2,
int off2,
int len)
public static boolean equals(int[] a1,
int[] a2)
public static boolean equals(int[] a1,
int off1,
int[] a2,
int off2,
int len)
public static boolean equals(long[] a1,
long[] a2)
public static boolean equals(long[] a1,
int off1,
long[] a2,
int off2,
int len)
public static boolean equals(char[] a1,
char[] a2)
public static boolean equals(char[] a1,
int off1,
char[] a2,
int off2,
int len)
public static <T> T[] createGenericArray(Class<T[]> clazz, int size)
public static <T> T[] createGenericArray(Class<T[]> clazz, Object[] content)
public static <T> T[] createGenericArrayOf(int size,
Class<T> type)
public static <T> List<T> intersectionIdentity(T[] a1, T[] a2)
public static <T> T[] concatenate(T[] a,
T[] b)
public static byte[] merge(List<byte[]> arrays)
public static int compare(byte[] b1,
byte[] b2)
public static int compare(byte[] b1,
int off1,
byte[] b2,
int off2,
int len)
public static <T> T[] add(T[] a,
T elem)
public static <T> T[] add(T[] a,
T elem,
int pos)
public static <T> T[] add(T[] a,
Collection<T> toAdd)
public static <T> T[] remove(T[] a,
T elem)
public static <T> T[] removeAt(T[] a,
int i)
public static <T> Iterator<T> iterator(T[] a)
public static byte[] copy(byte[] a)
public static int[] toArray(Collection<Integer> col)
public static <T> ArrayList<T> newArrayList(T[] items)
public static int search(byte[] toFind,
byte[] array)
public static int search(byte[] toFind,
byte[] array,
int start)
public static int search(byte[] toFind,
byte[] array,
int start,
int len)
Copyright © 2019. All rights reserved.