| 限定符和类型 | 字段和说明 |
|---|---|
static Class |
BOOLEAN_ARRAY_CLASS |
static Class |
BYTE_ARRAY_CLASS |
static Class |
CHAR_ARRAY_CLASS |
static Class |
DOUBLE_ARRAY_CLASS |
static Class |
FLOAT_ARRAY_CLASS |
static int |
INDEX_NOT_FOUND
The index value when an element is not found in a list or array:
-1. |
static Class |
INT_ARRAY_CLASS |
static Class |
LONG_ARRAY_CLASS |
static List<Class> |
PRIMITIVE_ARRAY_CLASSES |
static Class |
SHORT_ARRAY_CLASS |
| 限定符 | 构造器和说明 |
|---|---|
protected |
PrimitiveArrays() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean[] |
clone(boolean[] array) |
static byte[] |
clone(byte[] array)
Clones an array returning a typecast result and handling
null. |
static char[] |
clone(char[] array)
Clones an array returning a typecast result and handling
null. |
static double[] |
clone(double[] array)
Clones an array returning a typecast result and handling
null. |
static float[] |
clone(float[] array)
Clones an array returning a typecast result and handling
null. |
static int[] |
clone(int[] array)
Clones an array returning a typecast result and handling
null. |
static long[] |
clone(long[] array)
Clones an array returning a typecast result and handling
null. |
static short[] |
clone(short[] array)
Clones an array returning a typecast result and handling
null. |
static <T> T[] |
clone(T[] array)
Shallow clones an array returning a typecast result and handling
null. |
static boolean[] |
copy(boolean[] values) |
static byte[] |
copy(byte[] values) |
static char[] |
copy(char[] values) |
static double[] |
copy(double[] values) |
static float[] |
copy(float[] values) |
static int[] |
copy(int[] values) |
static long[] |
copy(long[] values) |
static short[] |
copy(short[] values) |
static boolean[] |
createBooleanArray(int length,
boolean initValue) |
static boolean[] |
createBooleanArray(int length,
Supplier<Integer,Boolean> initValueSupplier) |
static byte[] |
createByteArray(int length,
byte initValue) |
static byte[] |
createByteArray(int length,
Supplier<Integer,Byte> initValueSupplier) |
static char[] |
createCharArray(int length,
char initValue) |
static char[] |
createCharArray(int length,
Supplier<Integer,Character> initValueSupplier) |
static double[] |
createDoubleArray(int length,
Double initValue) |
static double[] |
createDoubleArray(int length,
Supplier<Integer,Double> initValueSupplier) |
static float[] |
createFloatArray(int length,
float initValue) |
static float[] |
createFloatArray(int length,
Supplier<Integer,Float> initValueSupplier) |
static int[] |
createIntArray(int length,
int initValue) |
static int[] |
createIntArray(int length,
Supplier<Integer,Integer> initValueSupplier) |
static long[] |
createLongArray(int length,
long initValue) |
static long[] |
createLongArray(int length,
Supplier<Integer,Long> initValueSupplier) |
static short[] |
createShortArray(int length,
short initValue) |
static short[] |
createShortArray(int length,
Supplier<Integer,Short> initValueSupplier) |
static boolean |
equals(boolean[] a,
boolean[] a2)
Returns true if the two specified arrays of booleans are
equal to one another.
|
static boolean |
equals(boolean[] a,
Boolean[] a2) |
static boolean |
equals(byte[] a,
byte[] a2)
Returns true if the two specified arrays of bytes are
equal to one another.
|
static boolean |
equals(byte[] a,
Byte[] a2) |
static boolean |
equals(char[] a,
char[] a2)
Returns true if the two specified arrays of chars are
equal to one another.
|
static boolean |
equals(char[] a,
Character[] a2) |
static boolean |
equals(double[] a,
double[] a2)
Returns true if the two specified arrays of doubles are
equal to one another.
|
static boolean |
equals(double[] a,
Double[] a2) |
static boolean |
equals(float[] a,
float[] a2)
Returns true if the two specified arrays of floats are
equal to one another.
|
static boolean |
equals(float[] a,
Float[] a2) |
static boolean |
equals(int[] a,
int[] a2)
Returns true if the two specified arrays of ints are
equal to one another.
|
static boolean |
equals(int[] a,
Integer[] a2) |
static boolean |
equals(long[] a,
long[] a2)
Returns true if the two specified arrays of longs are
equal to one another.
|
static boolean |
equals(long[] a,
Long[] a2) |
static boolean |
equals(Object[] a,
Object[] a2)
Returns true if the two specified arrays of Objects are
equal to one another.
|
static boolean |
equals(short[] a,
short[] a2)
Returns true if the two specified arrays of shorts are
equal to one another.
|
static boolean |
equals(short[] a,
Short[] a2) |
static int |
indexOf(boolean[] array,
boolean valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(boolean[] array,
boolean valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(byte[] array,
byte valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(byte[] array,
byte valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(char[] array,
char valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(char[] array,
char valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(double[] array,
double valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(double[] array,
double valueToFind,
double tolerance)
Finds the index of the given value within a given tolerance in the array.
|
static int |
indexOf(double[] array,
double valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(float[] array,
float valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(float[] array,
float valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(int[] array,
int valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(int[] array,
int valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(long[] array,
long valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(long[] array,
long valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static int |
indexOf(short[] array,
short valueToFind)
Finds the index of the given value in the array.
|
static int |
indexOf(short[] array,
short valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
|
static boolean[] |
insert(int index,
boolean[] array,
boolean... values)
Inserts elements into an array at the given index (starting from zero).
|
static byte[] |
insert(int index,
byte[] array,
byte... values)
Inserts elements into an array at the given index (starting from zero).
|
static char[] |
insert(int index,
char[] array,
char... values)
Inserts elements into an array at the given index (starting from zero).
|
static double[] |
insert(int index,
double[] array,
double... values)
Inserts elements into an array at the given index (starting from zero).
|
static float[] |
insert(int index,
float[] array,
float... values)
Inserts elements into an array at the given index (starting from zero).
|
static int[] |
insert(int index,
int[] array,
int... values)
Inserts elements into an array at the given index (starting from zero).
|
static long[] |
insert(int index,
long[] array,
long... values)
Inserts elements into an array at the given index (starting from zero).
|
static short[] |
insert(int index,
short[] array,
short... values)
Inserts elements into an array at the given index (starting from zero).
|
static <T> T[] |
insert(int index,
T[] array,
T... values)
Inserts elements into an array at the given index (starting from zero).
|
static boolean |
isPrimitiveArray(Class clazz) |
static boolean[] |
unwrap(Boolean[] values,
boolean resultNullable)
convert a Boolean[] to a boolean[]
|
static byte[] |
unwrap(Byte[] values,
boolean resultNullable)
convert a Byte[] to a byte[]
|
static char[] |
unwrap(Character[] values,
boolean resultNullable)
convert a Character[] to a char[]
|
static double[] |
unwrap(Double[] values,
boolean resultNullable)
convert a Double[] to a double[]
|
static float[] |
unwrap(Float[] values,
boolean resultNullable)
convert a Float[] to a float[]
|
static int[] |
unwrap(Integer[] values,
boolean resultNullable)
convert a Integer[] to a int[]
|
static long[] |
unwrap(Long[] values,
boolean resultNullable)
convert a Long[] to a long[]
|
static short[] |
unwrap(Short[] values,
boolean resultNullable)
convert a Short[] to a short[]
|
static Boolean[] |
wrap(boolean[] values,
boolean resultNullable)
convert a boolean[] to a Boolean[]
|
static Byte[] |
wrap(byte[] values,
boolean resultNullable)
convert a byte[] to a Byte[]
|
static Character[] |
wrap(char[] values,
boolean resultNullable)
convert a char[] to a Character[]
|
static Double[] |
wrap(double[] values,
boolean resultNullable)
convert a double[] to a Double[]
|
static Float[] |
wrap(float[] values,
boolean resultNullable)
convert a float[] to a Float[]
|
static Integer[] |
wrap(int[] values,
boolean resultNullable)
convert a int[] to a Integer[]
|
static Long[] |
wrap(long[] values,
boolean resultNullable)
convert a long[] to a Long[]
|
static <E> E[] |
wrap(Object o) |
static Short[] |
wrap(short[] values,
boolean resultNullable)
convert a short[] to a Short[]
|
public static final Class BYTE_ARRAY_CLASS
public static final Class SHORT_ARRAY_CLASS
public static final Class INT_ARRAY_CLASS
public static final Class LONG_ARRAY_CLASS
public static final Class FLOAT_ARRAY_CLASS
public static final Class DOUBLE_ARRAY_CLASS
public static final Class CHAR_ARRAY_CLASS
public static final Class BOOLEAN_ARRAY_CLASS
public static final int INDEX_NOT_FOUND
-1.
This value is returned by methods in this class and can also be used in comparisons with values returned by
various method from List.public static boolean isPrimitiveArray(Class clazz)
public static <E> E[] wrap(Object o)
public static Boolean[] wrap(@Nullable boolean[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static boolean[] unwrap(@Nullable Boolean[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Character[] wrap(@Nullable char[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static char[] unwrap(@Nullable Character[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Byte[] wrap(@Nullable byte[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static byte[] unwrap(@Nullable Byte[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Short[] wrap(@Nullable short[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static short[] unwrap(@Nullable Short[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Integer[] wrap(@Nullable int[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static int[] unwrap(@Nullable Integer[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Float[] wrap(@Nullable float[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static float[] unwrap(@Nullable Float[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Long[] wrap(@Nullable long[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static long[] unwrap(@Nullable Long[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static Double[] wrap(@Nullable double[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static double[] unwrap(@Nullable Double[] values, boolean resultNullable)
values - sourceresultNullable - whether return null when source is null or notpublic static boolean equals(long[] a,
long[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(long[] a,
Long[] a2)
public static boolean equals(int[] a,
int[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(int[] a,
Integer[] a2)
public static boolean equals(short[] a,
short[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(short[] a,
Short[] a2)
public static boolean equals(char[] a,
char[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(char[] a,
Character[] a2)
public static boolean equals(byte[] a,
byte[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(byte[] a,
Byte[] a2)
public static boolean equals(boolean[] a,
boolean[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static boolean equals(boolean[] a,
Boolean[] a2)
public static boolean equals(double[] a,
double[] a2)
Two doubles d1 and d2 are considered equal if:
new Double(d1).equals(new Double(d2))(Unlike the == operator, this method considers NaN equals to itself, and 0.0d unequal to -0.0d.)
a - one array to be tested for equalitya2 - the other array to be tested for equalityDouble.equals(Object)public static boolean equals(double[] a,
Double[] a2)
public static boolean equals(float[] a,
float[] a2)
Two floats f1 and f2 are considered equal if:
new Float(f1).equals(new Float(f2))(Unlike the == operator, this method considers NaN equals to itself, and 0.0f unequal to -0.0f.)
a - one array to be tested for equalitya2 - the other array to be tested for equalityFloat.equals(Object)public static boolean equals(float[] a,
Float[] a2)
public static boolean equals(Object[] a, Object[] a2)
a - one array to be tested for equalitya2 - the other array to be tested for equalitypublic static byte[] createByteArray(int length,
byte initValue)
public static byte[] createByteArray(int length,
Supplier<Integer,Byte> initValueSupplier)
public static short[] createShortArray(int length,
short initValue)
public static short[] createShortArray(int length,
Supplier<Integer,Short> initValueSupplier)
public static char[] createCharArray(int length,
char initValue)
public static char[] createCharArray(int length,
Supplier<Integer,Character> initValueSupplier)
public static int[] createIntArray(int length,
int initValue)
public static int[] createIntArray(int length,
Supplier<Integer,Integer> initValueSupplier)
public static long[] createLongArray(int length,
long initValue)
public static long[] createLongArray(int length,
Supplier<Integer,Long> initValueSupplier)
public static float[] createFloatArray(int length,
float initValue)
public static float[] createFloatArray(int length,
Supplier<Integer,Float> initValueSupplier)
public static double[] createDoubleArray(int length,
Double initValue)
public static double[] createDoubleArray(int length,
Supplier<Integer,Double> initValueSupplier)
public static boolean[] createBooleanArray(int length,
boolean initValue)
public static boolean[] createBooleanArray(int length,
Supplier<Integer,Boolean> initValueSupplier)
public static byte[] copy(byte[] values)
public static short[] copy(short[] values)
public static int[] copy(int[] values)
public static boolean[] copy(boolean[] values)
public static char[] copy(char[] values)
public static float[] copy(float[] values)
public static double[] copy(double[] values)
public static long[] copy(long[] values)
public static int indexOf(boolean[] array,
boolean valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(boolean[] array,
boolean valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null
array inputpublic static int indexOf(byte[] array,
byte valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(byte[] array,
byte valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(char[] array,
char valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(char[] array,
char valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(double[] array,
double valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(double[] array,
double valueToFind,
double tolerance)
Finds the index of the given value within a given tolerance in the array. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findtolerance - tolerance of the searchINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(double[] array,
double valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance)
Finds the index of the given value in the array starting at the given index. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching attolerance - tolerance of the searchINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(float[] array,
float valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(float[] array,
float valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(int[] array,
int valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(int[] array,
int valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(long[] array,
long valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(long[] array,
long valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(short[] array,
short valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
array - the array to search through for the object, may be nullvalueToFind - the value to findINDEX_NOT_FOUND (-1) if not found or null array inputpublic static int indexOf(short[] array,
short valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (-1) for a null input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND (-1).
array - the array to search through for the object, may be nullvalueToFind - the value to findstartIndex - the index to start searching atINDEX_NOT_FOUND (-1) if not found or null array inputpublic static boolean[] insert(int index,
boolean[] array,
boolean... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static byte[] insert(int index,
byte[] array,
byte... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static char[] insert(int index,
char[] array,
char... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static double[] insert(int index,
double[] array,
double... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static float[] insert(int index,
float[] array,
float... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static int[] insert(int index,
int[] array,
int... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static long[] insert(int index,
long[] array,
long... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static short[] insert(int index,
short[] array,
short... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
index - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static <T> T[] insert(int index,
T[] array,
T... values)
Inserts elements into an array at the given index (starting from zero).
When an array is returned, it is always a new array.
ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null
T - The type of elements in array and valuesindex - the position within array to insert the new valuesarray - the array to insert the values into, may be nullvalues - the new values to insert, may be nullIndexOutOfBoundsException - if array is provided
and either index < 0 or index > array.lengthpublic static boolean[] clone(boolean[] array)
public static byte[] clone(byte[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static char[] clone(char[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static double[] clone(double[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static float[] clone(float[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static int[] clone(int[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static long[] clone(long[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static short[] clone(short[] array)
Clones an array returning a typecast result and handling
null.
This method returns null for a null input array.
array - the array to clone, may be nullnull if null inputpublic static <T> T[] clone(T[] array)
Shallow clones an array returning a typecast result and handling
null.
The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.
This method returns null for a null input array.
T - the component type of the arrayarray - the array to shallow clone, may be nullnull if null inputCopyright © 2022. All rights reserved.