2020-11-16 02:55:33 +01:00
|
|
|
package speiger.src.collections.PACKAGE.utils;
|
|
|
|
|
|
|
|
public class ARRAYS
|
2020-11-26 22:56:15 +01:00
|
|
|
{
|
2020-11-16 02:55:33 +01:00
|
|
|
#if !TYPE_OBJECT
|
2020-11-26 22:56:15 +01:00
|
|
|
public static final KEY_TYPE[] EMPTY_ARRAY = new KEY_TYPE[0];
|
|
|
|
|
2020-11-16 02:55:33 +01:00
|
|
|
public static CLASS_TYPE[] wrap(KEY_TYPE[] a) {
|
|
|
|
CLASS_TYPE[] result = new CLASS_TYPE[a.length];
|
|
|
|
for(int i = 0,m=a.length;i<m;i++)
|
|
|
|
result[i] = KEY_TO_OBJ(a[i]);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static KEY_TYPE[] unwrap(CLASS_TYPE[] a) {
|
|
|
|
KEY_TYPE[] result = new KEY_TYPE[a.length];
|
|
|
|
for(int i = 0,m=a.length;i<m;i++)
|
|
|
|
result[i] = OBJ_TO_KEY(a[i]);
|
|
|
|
return result;
|
|
|
|
}
|
2020-11-26 22:56:15 +01:00
|
|
|
|
|
|
|
#else
|
|
|
|
public static final Object[] EMPTY_ARRAY = new Object[0];
|
|
|
|
|
|
|
|
public static KEY_GENERIC_TYPE KEY_TYPE[] newArray(Class<KEY_TYPE> clz, int length) {
|
|
|
|
if(clz == Object.class) return (KEY_TYPE[])new Object[length];
|
|
|
|
return (KEY_TYPE[]) java.lang.reflect.Array.newInstance(clz, length);
|
|
|
|
}
|
2020-11-16 02:55:33 +01:00
|
|
|
#endif
|
|
|
|
}
|