class InstantRunVerifier {

    @VisibleForTesting
    @NonNull
    static <T> Diff diffList(
            @Nullable List<T> one,
            @Nullable List<T> two,
            @NonNull Comparator<T> comparator) {

        if (one == null && two == null) {
            return Diff.NONE;
        }
        if (one == null) {
            return Diff.ADDITION;
        }
        if (two == null) {
            return Diff.REMOVAL;
        }
        List<T> copyOfOne = new ArrayList<T>(one);
        List<T> copyOfTwo = new ArrayList<T>(two);

        for (T elementOfTwo : two) {
            T commonElement = getElementOf(copyOfOne, elementOfTwo, comparator);
            if (commonElement != null) {
                copyOfOne.remove(commonElement);
            }
        }

        for (T elementOfOne : one) {
            T commonElement = getElementOf(copyOfTwo, elementOfOne, comparator);
            if (commonElement != null) {
                copyOfTwo.remove(commonElement);
            }
        }
        if ((!copyOfOne.isEmpty()) && (copyOfOne.size() == copyOfTwo.size())) {
            return Diff.CHANGE;
        }
        if (!copyOfOne.isEmpty()) {
            return Diff.REMOVAL;
        }
        return copyOfTwo.isEmpty() ? Diff.NONE : Diff.ADDITION;
    }

    private  InstantRunVerifier();

}