I got the HashMap:
HashMap<String, List<Value>> facetsInCategories = new HashMap<>();
I need to sort the List of Values inside the value of this HashMap. The value in the list has four fields, and I need to sort the list by the "translatedValue" String. That is why I put "getTranslatedValue" in custom comparator. Here is Value object fields:
public String name;
public int count;
private String translatedValue;
private String translation;
And here is what I tried:
for (List<Value> value : facetsInCategories.values()) {
Collections.sort(value, new Comparator<Value>() {
@Override
public int compare(Value o1, Value o2) {
return o1.getTranslatedValue().compareTo(o2.getTranslatedValue());
}
});
}
I've been doing this for couple of hours now, so I thought you may advise somehow on that.