If we have a simple list like

We can easily sort this list using

or by using closure like

Both gives us a list sorted in ascending order.

sort modifies the original list i.e., original list is also sorted. If you do not want to modify the original list then just pass false as argument like

Using closure we can also sort object by its property:

We can also sort list in descending order but if we compare numeric fields only

Hope this helps 🙂 .