FavoriteYadhu Krishnan (Inno Valley Works) posted in Bangalore Developer User Group (Originally asked by Yadhu Krishnan)Dec 21, 2023, 1:47 PMYadhu KrishnanDoes anyone know what sorting algorithm does the Comparator Interface use?We can implement different sort orders with the Comparator interface’s compare() method, and pass the Comparator as a parameter to List.sort(). Does anyone know what sorting algorithm the Comparator Interface uses or will we be able to implement any of the sorting algorithms as per our need?Since it looks like it is using the bubble sort from the example given here:https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_System_Comparator.htm#apex_interface_System_Comparator_ExampleShow MoreAdd a commentWrite a comment...BoldItalicUnderlineStrikethroughBulleted ListNumbered ListAdd linkCode blockInsert imageAttach filesLink URLCancelSave0/9000Reply
Yadhu KrishnanDoes anyone know what sorting algorithm does the Comparator Interface use?We can implement different sort orders with the Comparator interface’s compare() method, and pass the Comparator as a parameter to List.sort(). Does anyone know what sorting algorithm the Comparator Interface uses or will we be able to implement any of the sorting algorithms as per our need?Since it looks like it is using the bubble sort from the example given here:https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_System_Comparator.htm#apex_interface_System_Comparator_ExampleShow More