Infosys Interview Question

How to get sorted collection?