### Question:
CollectionHelper { public static <T> T[] toArray (final Collection<T> collection) throws NoSuchMethodException { if (!isValid(collection)) { return null; } return (T[]) collection.toArray(); } private  CollectionHelper(); static void sortDesc(final List<Integer> numbers); static boolean isValid(final Collection collection); static String toString(final Collection collection); static T[] toArray(final Collection<T> collection); static boolean isEmpty(final Collection<?> collection); static boolean isEmpty(final Map<?, ?> map);  }### Answer:
@Test public void testToArray () throws NoSuchMethodException { final List<String> namse = Arrays.asList("bascker", "johnnie", "lisa", "an"); final String[] names = CollectionHelper.toArray(namse); LOG.info(Arrays.toString(names)); final String[] rs = CollectionHelper.toArray(Collections.emptyList()); LOG.info(Arrays.toString(rs)); }