I have a HashMap HashMap<String, List<OtherModel>>
- I need to sort by the field of the first List<OtherModel>
element, have any ideas?)
I have incorrect code for example:
public static HashMap<String, List<AsoInfoModel>> sortAsoByValue(HashMap<String, List<AsoInfoModel>> items) {
List<Map.Entry<String, List<AsoInfoModel>>> list = new LinkedList<>(items.entrySet());
list.stream().sorted(Comparator.comparing(Map.Entry::getValue::AsoInfoModel::position, Comparator.naturalOrder());
HashMap<String, List<AsoInfoModel>> temp = new LinkedHashMap<>();
for (Map.Entry<String, List<AsoInfoModel>> aa : list) {
temp.put(aa.getKey(), aa.getValue());
}
return temp;
}