package com.hithomelabs.princeton1.module5;

import java.util.Comparator;

public interface ComparatorComparableSort<E> extends ComparableSort<E> {

    public void sort(E[] arr, Comparator<E> cmp);

    public default boolean less(E v, E w, Comparator<E> cmp){
        if (cmp == null)
            return ComparableSort.super.less((Comparable<E>) v, w);
        else
            return cmp.compare(v, w) < 0;
    }
}
