You\'re thinking of changing the HonorsCourse (from the previous question) so th
ID: 3801939 • Letter: Y
Question
You're thinking of changing the HonorsCourse (from the previous question) so that it uses an Arraylist instead of an Array. One of the advantages you see is the availability of sorting, which would be useful as it would help sort students (by their IDs). Write the necessary lines of changed/added code in Student to make it possible for the sorting to work properly, so It's ready when you make the jump to an ArrayList. Note that you are not being asked to code the entire Array to ArrayList conversion, just the sorting support.Explanation / Answer
Here is the example of sorting in arraylist :
Since the program is not available, So I am explaining you with example.
I am using Collections.reverseOrder()method along with Collections.sort() in order to sort the list in decreasing order. In the below example we have used the following statement for sorting in reverse order.
Collections.sort(arraylist, Collections.reverseOrder());
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.