Map<XMLGregorianCalendar, String> SortedByTimeForJourney = new HashMap<XMLGregorianCalendar, String>();
I have to sort it by key(XMLGregorianCalendar). I tried this
SortedByTimeForJourney.entrySet().stream().sorted(Map.Entry.<XMLGregorianCalendar, String>comparingByKey()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
but it is showing Type Parameter 'javax.xml.datatype.XMLGregorianCalendar' is not withing its bound; should implement 'java.lang.Comparable'
I also tried to do by saving it in LinkedHashMap and also using Collections.util method but unable to do.
Someone Please Help me.