package com.hithomelabs.princeton1.module5;

import java.util.Comparator;

public interface ComparatorHelper extends ComparableHelper {

    static <T> boolean less(T v, T w, Comparator<T> cmp) {
        if (cmp == null) return ComparableHelper.less(v, w);
        else
            return cmp.compare(v, w) < 0;
    }

    static <T> boolean equals(T v, T w, Comparator<T> cmp) {
        if (cmp == null) return ComparableHelper.equals(v, w);
        else
            return cmp.compare(v, w) == 0;
    }

}
