1

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?

11

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);
timeList.sort();

Not the answer you're looking for? Browse other questions tagged or ask your own question.