### Question:
CollectionUtils { public static <T> T firstElementOf(final Collection<? extends T> collection) { if (isEmpty(collection)) { return null; } return collection.iterator().next(); } private  CollectionUtils(); static List<?> arrayToList(final Object source); static List<T> filter(final Iterable<? extends T> unfiltered, final Filter<T> filter); static T firstElementOf(final Collection<? extends T> collection); static boolean isEmpty(final Collection<?> collection); static boolean isEmpty(final Map<?, ?> map); static Collection<T> populate(final Collection<T> collection,
      final Collection<? extends T> items);  }### Answer:
@Test public void testFirstElementOfEmptyCollection() { assertNull(CollectionUtils.firstElementOf(Collections.emptySet())); }
@Test public void testFirstElementOfMultiElementCollection() { final String[] members = {"x", "y", "z"}; assertEquals(members[0], CollectionUtils.firstElementOf(Arrays.asList(members))); }
@Test public void testFirstElementOfNullCollection() { assertNull(CollectionUtils.firstElementOf(null)); }
@Test public void testFirstElementOfSingleElementCollection() { final String member = "x"; assertEquals(member, CollectionUtils.firstElementOf(Collections.singleton(member))); }