Updating the Phone Book Application II
Let’s integrate the sorting functionality into the phone book application.
We'll cover the following
Now that we know where to get and write our data, it is time to learn how to sort it using sort.Interface
.
Using the sort
package
The first thing to decide when trying to sort data is the field that is going to be used for sorting. After that, we need to decide what we are going to do when two or more records have the same value in the main field used for sorting.
The code related to sorting using sort.Interface
is the following:
Get hands-on with 1400+ tech skills courses.