IterableUtils { public static <K> boolean isEmpty(final Iterable<? super K> iterable) { checkNotNull(iterable); return !iterable.iterator().hasNext(); } private  IterableUtils(); static boolean isEmpty(final Iterable<? super K> iterable); static List<K> listCopy(final Iterable<? extends K> iterable); static List<K> sortedListCopy(final Iterable<? extends K> iterable); static List<K> sortedReversedListCopy(final Iterable<? extends K> iterable); static List<K> sortedListCopy(final Iterable<? extends K> iterable,
                                             final Comparator<? super K> comparator); static List<K> sortedReversedListCopy(final Iterable<? extends K> iterable,
                                                     final Comparator<? super K> comparator); static int size(final Iterable<? extends K> iterable);  }
@Test public void testWhenEmptyIterableIsGivenThenWhenIsEmptyIsCalledThenTrueIsReturned() throws Exception { final Iterable<Object> emptyIterable = ImmutableList.of(); final boolean isEmpty = IterableUtils.isEmpty(emptyIterable); assertThat(isEmpty, is(true)); }
@Test public void testWhenNonEmptyIterableIsGivenThenWhenIsEmptyIsCalledThenFalseIsReturned() throws Exception { final Iterable<Object> nonEmptyIterable = ImmutableList.of(new Object()); final boolean isEmpty = IterableUtils.isEmpty(nonEmptyIterable); assertThat(isEmpty, is(false)); }