package com.hithomelabs.princeton1.module5;

// * * Provides a set of helper functions less and exch for Comparable data types
public interface ComparableHelper {

    static <T> void exch(T[] arr, int j, int i) {
        T temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    static <T> boolean less(T e1, T e2) {
        return ((Comparable<T>)e1).compareTo(e2) < 0;
    }

    static <T> boolean equals(T e1, T e2) { return ((Comparable<T>)e1).compareTo(e2) == 0;}

}
