I have map Map<LocalDateTime, String>
.
How can I sort it by key values? What comparator should I use?
someMap.entrySet().stream().sorted(Comparator.comparing(???))
or
someMap.entrySet().stream().sorted(??)
How can I resolve it? What should I write instead "??" ?
Sorted:
Key Value
2020-01-09 09:57:58.631 Some info
2020-01-09 09:57:59.224 Some info
2020-01-09 09:59:03.144 Info
Without sorting:
Key Value
2020-01-09 09:57:58.631 Some info
2020-01-09 09:59:03.144 Info
2020-01-09 09:57:59.224 Some info