src/main/java/com/zandero/utils/MapUtils.java
public static <K, V> Map<K, V> sort(Map<K, V> map, Comparator<Map.Entry<K, V>> comparator) {

		Assert.notNull(map, "Missing map!");
		Assert.notNull(comparator, "Missing comparator!");

		List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
		Collections.sort(list, comparator);


		Map<K, V> result = new LinkedHashMap<>();
		for (Map.Entry<K, V> entry : list) {
			result.put(entry.getKey(), entry.getValue());
		}
		return result;
	}
public static <K, V> Map<K, V> sort(Map<K, V> map, Comparator<Map.Entry<K, V>> comparator) {

		Assert.notNull(map, "Missing map!");
		Assert.notNull(comparator, "Missing comparator!");

		List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
		Collections.sort(list, comparator);


		Map<K, V> result = new LinkedHashMap<>();
		for (Map.Entry<K, V> entry : list) {
			result.put(entry.getKey(), entry.getValue());
		}
		return result;
	}
Sorts map with comparator

@param map        to be sorted
@param comparator to apply
@param <K>        type of key
@param <V>        type of value
@return sorted map (LinkedHashMap)