2019.2.17

2019.2.17

public static <T> void bubbleSort (T[] list, Comparator<? super T> comparator){
        for(int i=list.length-1;i>0;i--){
            for(int j=0;j<i;j++){
                if(comparator.compare(list[j],list[j+1]) > 0){
                    T tmp = list[j];
                    list[j] = list[j+1];
                    list[j+1] = tmp;
                }
            }
        }
    }

你可能感兴趣的:(琉璃神社)