CollectionUtils { public static boolean isPrimitiveArray(Class<?> aClass) { return aClass.isArray() && aClass.getComponentType().isPrimitive(); } private  CollectionUtils(); static boolean isArray(Class<?> aClass); static boolean isCollection(Class<?> aClass); static boolean isList(Class<?> aClass); static boolean isSet(Class<?> aClass); static boolean isPrimitiveArray(Class<?> aClass); static int getLengthOfCollection(Object value); static Object getValueFromCollection(Object collection, int index); static Set<?> createNewSet(Class<T> destType); static Set<?> createNewSet(Class<T> destSetType, Collection<?> srcValue); static Object convertListToArray(List<T> list, Class<T> destEntryType); static List<Object> convertPrimitiveArrayToList(Object primitiveArray); static Set<E> intersection(final Set<E> set1, final Set<?> set2);  }
@Test public void testIsPrimitiveArray() { Object[] values = new Object[] {new int[3], new long[2], new boolean[3]}; for (int i = 0; i < values.length; i++) { assertTrue(CollectionUtils.isPrimitiveArray(values[i].getClass())); } }
@Test public void testIsPrimitiveArray_False() { Object[] values = new Object[] {new String[3], new Date[2], new SimpleObj[3]}; for (int i = 0; i < values.length; i++) { assertFalse(CollectionUtils.isPrimitiveArray(values[i].getClass())); } }