public class ArrayUtils extends Object
| Constructor and Description |
|---|
ArrayUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
coerceDimsList(List<Long> dimsListIn,
int numOutputDims)
Either grow or shrink the input list, containing the dimensions of an array, to match the target size passed
as the second input using the rules set by Java MATLAB Interface (JMI) for dimension coercion.
|
static <T> T[] |
convertToArray(List<?> list,
Class<T> c)
Converts a list of any type into an Array of Type T
|
static List<Integer> |
convertToIntegerList(int[] src)
Converts an array of primitive int's into a List of java.lang.Integer's
|
static List<Short> |
convertToShortList(List<Integer> src)
Converts a list of java.lang.Integer into a list of java.lang.Short
|
static Map<Class,Class> |
createBoxedToUnBoxedTypeMap()
Creates a Map of JAVA boxed types to their corresponsing primitive types.
|
static Class |
getArrayElementType(Object arr)
Returns the type of an element in an array.
|
static String |
getCamelCasedClassName(Class cls)
Returns camelcased version of a class name.
|
static List<Integer> |
getDimsArray(Object obj)
Return the dimensions of an array.
|
static int |
getNumberOfDimensions(Object input)
Get number of dimensions of input object.
|
static List<Integer> |
getStrides(List<Integer> len)
Returns the numeric value of the stride required to jump across dimensions
in an array
e.g a {4,3,2} dimension array will have {1,4,12,24} as the strides array
|
static boolean |
isOneDimArray(Object obj)
Determines if the passed in Object is an array and of one dimension
|
static Byte[] |
toBoxedArray(byte[] src)
Coverts an array of byte into array of java.lang.Byte
|
static Character[] |
toCharacterArray(Integer[] array)
Coverts an array of java.lang.Integer into array of java.lang.Character
|
static char[] |
toCharArray(Integer[] array)
Coverts an array of java.lang.Integer into array of char
|
static int[] |
toIntArray(Long[] array)
Coverts an array of java.lang.Long into array of int
|
static <T> Object |
toPrimitiveArray(Object[] array,
Class<T> c)
Generic definition of toPrimitiveArray
Converts an array of boxed type to primitive type
|
static Class |
unBoxIfBoxedType(Class inClass)
Returns class of a JAVA primitive type corresponding to a JAVA boxed type.
|
public static Class getArrayElementType(Object arr)
arr - An arraypublic static List<Integer> getDimsArray(Object obj)
obj - An arraypublic static List<Integer> getStrides(List<Integer> len)
len - Dimension arraypublic static boolean isOneDimArray(Object obj)
obj - An arraypublic static String getCamelCasedClassName(Class cls)
cls - Class of the type that needs to be camelcased.public static Class unBoxIfBoxedType(Class inClass)
inClass - Class of a JAVA typepublic static Map<Class,Class> createBoxedToUnBoxedTypeMap()
public static List<Integer> convertToIntegerList(int[] src)
src - Array of primitive int'spublic static List<Short> convertToShortList(List<Integer> src)
src - List of java.lang.Integerpublic static <T> T[] convertToArray(List<?> list, Class<T> c)
public static <T> Object toPrimitiveArray(Object[] array, Class<T> c)
public static int[] toIntArray(Long[] array)
array - array of java.lang.Longpublic static char[] toCharArray(Integer[] array)
array - array of java.lang.Integerpublic static Character[] toCharacterArray(Integer[] array)
array - array of java.lang.Integerpublic static Byte[] toBoxedArray(byte[] src)
src - array of bytepublic static boolean coerceDimsList(List<Long> dimsListIn, int numOutputDims)
dimsListIn - Input list containing dimensions of an arraynumOutputDims - target size for the input listpublic static int getNumberOfDimensions(Object input)
input - A Java objectCopyright © 2015–2024. All rights reserved.