In this last step, we are checking that the grocery items are returned in ascending order by their name. This seemingly simple statement actually tells us a bit more about what we should include in our groceryItems entity:
- A method that checks whether the grocery items are ordered by name in ascending order
- A field for each grocery item that defines its name (which could just be a string)
- A definition of ascending order for the name field
For now, we just need to name the first method. Let's call it isSortedBy:
In the method implementation, we will be able to leverage algorithms and iterators provided by either Qt or some other library ...