public final class ArrayConversion extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Set<T> |
arrayToSet(T[] names) |
static Object[] |
createObjectArrayType(Class elementType,
int size)
Create an array whose type is elementType[] of specified size.
|
static boolean |
hasIdenticalElementClasses(Object[] a) |
static Object[] |
setToArray(Set<?> s)
Convert a Set to an Object[].
|
static Object[] |
setToArray(Set<?> s,
boolean specialize)
Convert a Set to an array.
|
static Object[] |
setToArray(Set<?> s,
Object[] out)
Convert a Set to an Object[].
|
static Object[] |
specializeArray(Object[] a)
Specialize the type of the array (if possible).
|
static Object[] |
subArray(Object[] in,
int start,
int end) |
static Object[] |
toAppropriateType(Object array)
Convert an an array of primitive types to an array of Objects of non-primitive
types eg int to Integer.
|
static Boolean[] |
toBooleans(boolean[] array) |
static Byte[] |
toBytes(byte[] array) |
static Character[] |
toCharacters(char[] array) |
static Double[] |
toDoubles(double[] array) |
static Float[] |
toFloats(float[] array) |
static Integer[] |
toIntegers(int[] array) |
static Long[] |
toLongs(long[] array) |
static <T> Set<T> |
toSet(T[] array) |
static Short[] |
toShorts(short[] array) |
public static Object[] toAppropriateType(Object array)
array - the array to convertpublic static Boolean[] toBooleans(boolean[] array)
public static Character[] toCharacters(char[] array)
public static Byte[] toBytes(byte[] array)
public static Short[] toShorts(short[] array)
public static Integer[] toIntegers(int[] array)
public static Long[] toLongs(long[] array)
public static Float[] toFloats(float[] array)
public static Double[] toDoubles(double[] array)
public static Object[] createObjectArrayType(Class elementType, int size)
elementType - the type of each entry of the arraysize - the number of elementspublic static <T> Set<T> toSet(T[] array)
public static boolean hasIdenticalElementClasses(Object[] a)
public static Object[] specializeArray(Object[] a)
a - the array to specializepublic static Object[] setToArray(Set<?> s, boolean specialize)
s - the Set to convertspecialize - decide whether to specialize the type or notpublic static Object[] setToArray(Set<?> s)
s - the Set to convertpublic static Object[] setToArray(Set<?> s, Object[] out)
s - the Set to convertout - the output array, must be of size s.size()public static <T> Set<T> arrayToSet(T[] names)
Copyright © 2019. All rights reserved.