so I'm trying to write a linear search which could be used for most non-primitive data types.
Here is the code I'm using:
public static <T> boolean search(Comparable<T> key, T[] array) {
    for(int i = 0; i < array.length; i++) {
        if(array[i].equals(key)) {
            return true;
        }
    }
    return false;
}
I was wondering if there is a better way this could be done, or a neater way. N.B. I am just looking to use a linear search algorithm
Thanks
 
     
    