What sorting algorithm used while overriding compare method of comparator interface?

前端 未结 2 1547
粉色の甜心
粉色の甜心 2021-01-15 20:55
 Collections.sort(ar, new Comparator() {
                      @Override
                        public int compare(Intervals o1, Intervals o2) {            


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 21:15

    The Comparator and Comparable interface don't do any sorting, so there is no sorting algorithm there. They just compare two Objects, something you need if you want to sort a list of those objects.

提交回复
热议问题