public double sumWithWeights(){
  double dSum=0;
  for (  TKeyType dKey : hDistro.keySet()) {
    if (dKey instanceof Double)     dSum+=((Double)dKey * getValue(dKey));
 else     dSum+=getValue(dKey);
  }
  return dSum;
}

public double sumWithWeights ( ) { double dSum = 0 ; for ( TKeyType dKey : hDistro . keySet ( ) ) { if ( dKey instanceof Double ) dSum += ( ( Double ) dKey * getValue ( dKey ) ) ; else dSum += getValue ( dKey ) ; } return dSum ; }
sums over all the values , taking into account the keys as weights . if keys are not double keys , then only the weights are considered to be equal to 1 .
