Sorts by Value a Map in descending order.

@param <K>
@param <V>
@param map
@return
430436
public static <K, V> Map<K, V> sortNumberMapByValueDescending(Map<K, V> map) {
        ArrayList<Map.Entry<K, V>> entries = new ArrayList<>(map.entrySet());
        Collections.sort(entries, (Map.Entry<K, V> a, Map.Entry<K, V> b) -> {
            Double va = TypeInference.toDouble(a.getValue());
            Double vb = TypeInference.toDouble(b.getValue());
            return -va.compareTo(vb);
        });
        
        Map<K, V> sortedMap = new LinkedHashMap<>();
        for (Map.Entry<K, V> entry : entries) {
          sortedMap.put(entry.getKey(), entry.getValue());
        }
        
        return sortedMap;
    }
900468
public static <K, V> Map<K, V> toCamelCaseMap(Map<K, V> map) {
		return (map instanceof LinkedHashMap) ? new CamelCaseLinkedMap<>(map) : new CamelCaseMap<>(map);
	}
1253571
public static Map<Metric, String> sortByValue(Map<Metric, String> map, final String reducerType) {
		List<Map.Entry<Metric, String>> list = new LinkedList<>(map.entrySet());

		Collections.sort(list, new Comparator<Map.Entry<Metric, String>>() {

			@Override
			public int compare(Map.Entry<Metric, String> o1, Map.Entry<Metric, String> o2) {
				if(reducerType.equals("name")) {
					return o1.getValue().compareTo(o2.getValue());
				}

				Double d1 = Double.parseDouble(o1.getValue());
				Double d2 = Double.parseDouble(o2.getValue());
				return (d1.compareTo(d2));
			}
		});

		Map<Metric, String> result = new LinkedHashMap<>();

		for (Map.Entry<Metric, String> entry : list) {
			result.put(entry.getKey(), entry.getValue());
		}
		return result;
	}
1075141
private static TreeMap<Double ,Set<String>> sortScoreMap(TreeMap<String, Double> scoreMap)
    {
        TreeMap<Double, Set<String>> result = new TreeMap<Double, Set<String>>(Collections.reverseOrder());
        for (Map.Entry<String, Double> entry : scoreMap.entrySet())
        {
            Set<String> sentenceSet = result.get(entry.getValue());
            if (sentenceSet == null)
            {
                sentenceSet = new HashSet<String>();
                result.put(entry.getValue(), sentenceSet);
            }
            sentenceSet.add(entry.getKey());
        }

        return result;
    }
1209647
public static <T> void removeValue(Map<?,T> map, T value) {
		ArrayList<Object> keys = new ArrayList<>();
		for (Map.Entry<?,T> e : map.entrySet())
			if (e.getValue().equals(value))
				keys.add(e.getKey());
		for (Object key : keys)
			map.remove(key);
	}
636415
public static <K,V> Map<V,K> array_flip(Map<K,V> map) {
        Map<V,K> flipped = new HashMap<>();
        for(Map.Entry<K,V> entry : map.entrySet()) {
            flipped.put(entry.getValue(), entry.getKey());
        }
        return flipped;
    }
1069302
public MapReduceOptions<T> map(final String map) {
        Assert.parametersNotNull("map", map);
        Assert.parameterNotEmpty("map", map);
        this.map = map;
        return this;
    }
153966
public static <K, V> Map<K, V> sortByValue(Map<K, V> map, final Comparator<? super V> comparator) {
		return sortByValueInternal(map, new EntryValueComparator<K, V>(comparator));
	}
361977
public static void vTransactionMapInit(SortedMap<String, Integer> map) {
        map.put("Pass", 0);
        map.put("Stop", 0);
        map.put("Fail", 0);
        map.put("Count", 0);
    }
573060
public static <K, V> MutableList<V> toSortedList(
            Map<K, V> map,
            Comparator<? super V> comparator)
    {
        return Iterate.toSortedList(map.values(), comparator);
    }
690961
public static <K, V> Map<K, V> sort(Map<K, V> map,
            Comparator<K> comparator) {
        TreeMap<K, V> sortedMap = new TreeMap<>(comparator);
        sortedMap.putAll(map);
        return sortedMap;
    }
134415
public static <K,V> SortedMap<K,V> asSynchronized(SortedMap<K,V> self) {
        return Collections.synchronizedSortedMap(self);
    }
279415
public static <K extends Comparable<K>, V> void toStringSorted(Map<K, V> map, StringBuilder builder) {
    builder.append("{");
    List<Entry<K,V>> sortedProperties = Maps.sortedEntries(map);
    int index = 0;
    for (Entry<K, V> entry : sortedProperties) {
      if (index > 0) {
        builder.append(", ");
      }
      builder.append(entry.getKey()).append("=").append(entry.getValue());
      index++;
    }
    builder.append("}");
  }
607716
public static <K, V> Map<K, V> removeNulls(Map<K, V> map) {
        Map<K, V> result = new LinkedHashMap<>();
        map.forEach((k, v) -> {
            if (v != null) {
                result.put(k, v);
            }
        });
        return result;
    }
889759
public static <K, E> List<E> getAndPutListIfAbsent(final Map<K, List<E>> map, final K key) {
        List<E> v = map.get(key);

        if (v == null) {
            v = new ArrayList<>();
            v = map.put(key, v);
        }

        return v;
    }
38254
static public <K,V> Map<K,V> map(Map<?,?> map)
	{
		return (Map<K,V>)map;
	}
863435
private Map<String, Object> sortColumns(Map<String, Object> next) {
		Map<String, Object> sortedColumns = new LinkedHashMap<>();
		if ( this.columns != null ) {
			for ( String column : this.columns ) {
				sortedColumns.put( column, next.get( column ) );
			}
		}
		return sortedColumns;
	}