|
|
||||||||
|
||||||||
|
||||||||
|
|
|
| if you want to sort based on natural order or object then use Comparable in Java and if you want to sort on some other attribute of object then Comparator in Java is the way to go. Now to understand these concepts lets see an example 1) There is class called Person, sort the Person based on person_id. 2) Sort the Person based on Name. |
![]() |
| |
|
• Discuss Tutorial
• Comment On Tutorial |
• View Tutorial
• Report Broken Link |
|
|