Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have a set<Times> in my apex code which i want to sort. My time comes like
12:00, 13:00,8:00,11:00. How can i sort the set in ascending order?
You can't sort a Set, as Sets are, by definition, unordered. Convert it to a List first:
List<Time> timeList = new List<Time>(timeSet);