package com.futurice.freesound.utils;

import android.support.annotation.NonNull;

import java.util.Collection;
import java.util.Iterator;

public final class CollectionUtils {

    /**
     * Verifies if the content of the collections is the same.
     *
     * @param first  Collection
     * @param second Collection
     * @return True if the content and the order of the collection are equal, otherwise false
     */
    public static <T> boolean areEqual(@NonNull final Collection<T> first,
                                       @NonNull final Collection<T> second) {
        if (first.size() != second.size()) {
            return false;
        }

        Iterator<T> firstIterator = first.iterator();
        Iterator<T> secondIterator = second.iterator();
        while (firstIterator.hasNext()) {
            if (!firstIterator.next().equals(secondIterator.next())) {
                return false;
            }
        }
        return true;
    }
}

@@ -67,22 +67,23 @@
 tation.N
-onN
 ull
+able
 ;%0A%0Aimpor
@@ -457,22 +457,23 @@
 Equal(@N
-onN
 ull
+able
  final C
@@ -537,14 +537,15 @@
   @N
-onN
 ull
+able
  fin
@@ -588,16 +588,51 @@
 f (first
+ == null %7C%7C second == null %7C%7C first
 .size() 

Allow null inputs and checks in CollectionUtils.areEqual