sort method
Sorts the Map based on the given function and RETURNS the sorted map. (Doesn't sort in place!)
Implementation
Map<K, V> sort(int Function(MapEntry<K, V>, MapEntry<K, V>) compare){
List<MapEntry<K, V>> mapAsList = entries.toList();
mapAsList.sort(compare);
return LinkedHashMap.fromEntries(mapAsList);
}