I have a list that I created with a Wrapper Class and a Comparable/compareTo method. So it is sorted the way I would like it. From this list I created a Map with the key being the list's Created Date. I did this because I needed a table with a list of items under each Created Date. I formatted the date into a string. I now need to sort the Key in DESC order so the most recent date is on top.
This is a two tiered question: first- toTo sort the keySet, once I create the the List
of keySet, how do I pull the value
from the map and match it to the List
?
keys = new List<String>(dateHeader.keySet());
keys.sort();
for(String st : keys){
//now what?
//something along the lines of:
//resortedMap.put(st, st.???);
}
Second - once the keySet is sorted, how do I avoid the auto sorting done by apex:repeat
? my plan is to just keep the list in ASC order via .sort() method so that it will flip it to DESC via apex:repeat. I was just curious if there was a way around apex:repeat auto filtering.
my map is: Map<String, CaseInfo[]> dateHeader