I learned how to use the comparable but I\'m having difficulty with the Comparator. I am having a error in my code:
Exception in thread \"main\" java.lang.C
For the sake of completeness.
Using Java8
people.sort(Comparator.comparingInt(People::getId));
if you want in descending order
descending order
people.sort(Comparator.comparingInt(People::getId).reversed());