public static <K>Map<K,Double> normalizeInvert(Map<K,Double> map){
  Double maxValue=0.0;
  for (  Double v : map.values()) {
    if (v > maxValue)     maxValue=v;
  }
  for (  Map.Entry<K,Double> e : map.entrySet()) {
    map.put(e.getKey(),1 - map.get(e.getKey()) / maxValue);
  }
  return map;
}

public static < K > Map < K , Double > normalizeInvert ( Map < K , Double > map ) { Double maxValue = 0.0 ; for ( Double v : map . values ( ) ) { if ( v > maxValue ) maxValue = v ; } for ( Map . Entry < K , Double > e : map . entrySet ( ) ) { map . put ( e . getKey ( ) , 1 - map . get ( e . getKey ( ) ) / maxValue ) ; } return map ; }
normalizes the values of a map via 1 - value / maxvalue
