Collections.sort(ar, new Comparator() { @Override public int compare(Intervals o1, Intervals o2) {
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.