排序作业
(泛型冒泡排序)使用冒泡排序编写下面两个泛型方法。第一个方法使用Comparable接口对元素排序,第二个方法使用Comparator接口对元素排序。 public static <E extends Comparable<E>> void bubbleSort(E[] list) public static <E> void bubbleSort(E[] list, Comparator<? super E> comparator) 答案 import java.util.Comparator; public class Exercise { /** Generic bubble sort…