package seedu.address.commons.util;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * Utility methods related to Collections
 */
public class CollectionUtil {

    /**
     * Returns true if any of the given items are null.
     */
    public static boolean isAnyNull(Object... items) {
        for (Object item : items) {
            if (item == null) {
                return true;
            }
        }
        return false;
    }



    /**
     * Throws an assertion error if the collection or any item in it is null.
     */
    public static void assertNoNullElements(Collection<?> items) {
        assert items != null;
        assert !isAnyNull(items);
    }

    /**
     * Returns true if every element in a collection are unique by {@link Object#equals(Object)}.
     */
    public static boolean elementsAreUnique(Collection<?> items) {
        final Set<Object> testSet = new HashSet<>();
        for (Object item : items) {
            final boolean itemAlreadyExists = !testSet.add(item); // see Set documentation
            if (itemAlreadyExists) {
                return false;
            }
        }
        return true;
    }
}

@@ -34,86 +34,8 @@
 l;%0A%0A
-import java.util.Collection;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A
@@ -392,719 +392,6 @@
  %7D%0A%0A
-%0A%0A    /**%0A     * Throws an assertion error if the collection or any item in it is null.%0A     */%0A    public static void assertNoNullElements(Collection%3C?%3E items) %7B%0A        assert items != null;%0A        assert !isAnyNull(items);%0A    %7D%0A%0A    /**%0A     * Returns true if every element in a collection are unique by %7B@link Object#equals(Object)%7D.%0A     */%0A    public static boolean elementsAreUnique(Collection%3C?%3E items) %7B%0A        final Set%3CObject%3E testSet = new HashSet%3C%3E();%0A        for (Object item : items) %7B%0A            final boolean itemAlreadyExists = !testSet.add(item); // see Set documentation%0A            if (itemAlreadyExists) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A
 %7D%0A

remove unused methods