-2
I am trying to start a class that is a Bubble Sort that extends a class called Comparable. My code is like this:
public final class BubbleSortPassPerItem<T extends Comparable<T>> implements Sorter<T> {
public void sort(final T[] items) {
for (int pass=0; pass<items.length; pass++) {
for (int i=0; i<items.length-1; i++) {
if (items[i].compareTo(items[i+1])>0) {
final T item = items[i];
items[i] = items[i+1];
items[i+1] = item;
}
}
}
}
}
I don’t quite understand how these parameterized classes work. How do I start this class in the Main method?