public final class ArrayFactory extends Object
ArrayFactory provides factory methods for create new Array
objects| Constructor and Description |
|---|
ArrayFactory() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
newArray(Class<T> cls,
int length)
Factory method for create new array from the given class type and the given length
|
static <T> T[] |
newArray(T... elements)
Factory method for create new array from the given optional elements.
|
static boolean[] |
newBooleanArray(boolean... elements)
Factory method for create new array of primitive boolean values from the given optional
elements.
|
static byte[] |
newByteArray(byte... elements)
Factory method for create new array of primitive byte values from the given optional
elements.
|
static char[] |
newCharArray(char... elements)
Factory method for create new array of primitive character values from the given optional
elements.
|
static double[] |
newDoubleArray(double... elements)
Factory method for create new array of primitive double values from the given optional
elements.
|
static <T> T[] |
newEmptyArray(T[] array)
Factory method for create new empty array with the length of the given array
|
static <T> T[] |
newEmptyArray(T[] array,
int length)
Factory method for create new empty array with the length of the given array.
|
static float[] |
newFloatArray(float... elements)
Factory method for create new array of primitive float values from the given optional
elements.
|
static int[] |
newIntArray(int... elements)
Factory method for create new array of primitive integer values from the given optional
elements.
|
static long[] |
newLongArray(long... elements)
Factory method for create new array of primitive long values from the given optional
elements.
|
static Integer[] |
newRangeArray(int start,
int end)
Creates a new
Integer array with the given range that is defined through start and
end. |
static short[] |
newShortArray(short... elements)
Factory method for create new array of primitive short values from the given optional
elements.
|
static <T> T[] |
newSubArray(T[] source,
int startIndex,
int endIndex)
Creates a new partial array from the given source array starting from the given start index
that is inclusive and the end index that is exclusive
|
public static <T> T[] newArray(Class<T> cls, int length)
T - the generic type of the elementscls - the class typelength - the capacity@SafeVarargs public static <T> T[] newArray(T... elements)
T - the generic type of the elementselements - the optional elements that will be in the returned array.public static <T> T[] newEmptyArray(@NonNull
T[] array)
T - the generic type of the elementsarray - the array that is used as a templatepublic static <T> T[] newEmptyArray(@NonNull
T[] array,
int length)
T - the generic type of the elementsarray - the array that is used as a templatelength - the length of the new empty arraypublic static Integer[] newRangeArray(int start, int end)
Integer array with the given range that is defined through start and
end. For instance if the start is 5 and the end is 9 the resulted array will be [5,6,7,8,9]start - The number to startend - The number to end minus oneInteger array@SafeVarargs public static boolean[] newBooleanArray(boolean... elements)
elements - the optional primitive boolean values that will be in the returned array of
primitive boolean values array.@SafeVarargs public static byte[] newByteArray(byte... elements)
elements - the optional primitive byte values that will be in the returned array of primitive
byte values array.@SafeVarargs public static char[] newCharArray(char... elements)
elements - the optional primitive character values that will be in the returned array of
primitive character values array.@SafeVarargs public static int[] newIntArray(int... elements)
elements - the optional primitive integer values that will be in the returned array of
primitive integer values array.@SafeVarargs public static long[] newLongArray(long... elements)
elements - the optional primitive long values that will be in the returned array of primitive
long values array.@SafeVarargs public static float[] newFloatArray(float... elements)
elements - the optional primitive float values that will be in the returned array of
primitive float values array.@SafeVarargs public static double[] newDoubleArray(double... elements)
elements - the optional primitive double values that will be in the returned array of
primitive double values array.@SafeVarargs public static short[] newShortArray(short... elements)
elements - the optional primitive short values that will be in the returned array of
primitive short values array.public static <T> T[] newSubArray(@NonNull
T[] source,
int startIndex,
int endIndex)
T - the generic typesource - the source arraystartIndex - the start index that is inclusiveendIndex - the end index that is exclusiveCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.