CollectionUtil { public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> iterable2) { return Iterables.elementsEqual(iterable1, iterable2); }  static boolean isEmpty(Collection<?> collection); static boolean isNotEmpty(Collection<?> collection); static T getFirst(Collection<T> collection); static T getLast(Collection<T> collection); static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> iterable2); static T min(Collection<? extends T> coll); static T min(Collection<? extends T> coll, Comparator<? super T> comp); static T max(Collection<? extends T> coll); static T max(Collection<? extends T> coll, Comparator<? super T> comp); static Pair<T, T> minAndMax(Collection<? extends T> coll); static Pair<T, T> minAndMax(Collection<? extends T> coll, Comparator<? super T> comp); static List<T> topN(Iterable<T> coll, int n); static List<T> topN(Iterable<T> coll, int n, Comparator<? super T> comp); static List<T> bottomN(Iterable<T> coll, int n); static List<T> bottomN(Iterable<T> coll, int n, Comparator<? super T> comp);  }
@Test public void listCompare() { List<String> list1 = ArrayUtil.asList("d", "a", "c", "b", "e", "i", "g"); List<String> list2 = ArrayUtil.asList("d", "a", "c", "b", "e", "i", "g"); List<String> list3 = ArrayUtil.asList("d", "c", "a", "b", "e", "i", "g"); List<String> list4 = ArrayUtil.asList("d", "a", "c", "b", "e"); List<String> list5 = ArrayUtil.asList("d", "a", "c", "b", "e", "i", "g", "x"); assertThat(CollectionUtil.elementsEqual(list1, list1)).isTrue(); assertThat(CollectionUtil.elementsEqual(list1, list2)).isTrue(); assertThat(CollectionUtil.elementsEqual(list1, list3)).isFalse(); assertThat(CollectionUtil.elementsEqual(list1, list4)).isFalse(); assertThat(CollectionUtil.elementsEqual(list1, list5)).isFalse(); }