java - Order objects based on ordering of member variables without comparator -
say have object
person private int age; private string name; and want sort them automatically using arrays.sort() such low ages come before high ages.
a mutual way comparator, many useful utility functions out there, there cleaner way this?
make class implement comparable.
java sorting
No comments:
Post a Comment