Object sequential searching using compareTo()

I have this simple method to search for an object that uses
Comparable
interface. But I'm wondering, why does my parameter should use
extends
instead of
implements
? Doesn't this break the law where an object can only extend ONE class, but is able to implement multiple interfaces? So why doesn't
implements
work here?

    public static <T extends Comparable<T>> int sequentialSearch(T[] list, T key) {
        for (int i = 0; i < list.length; i++) {
            if (list[i].compareTo(key) == 0)
                return i;
        }
        return -1;
    }
Was this page helpful?