Sum all of the values in this dictionary, then return a new FloatDict of each key, divided by the total sum. The total for all values will be ~1.0. @return a FloatDict with the original keys, mapped to their pct of the total
()
| 779 | * @return a FloatDict with the original keys, mapped to their pct of the total |
| 780 | */ |
| 781 | public DoubleDict getPercent() { |
| 782 | double sum = sum(); |
| 783 | DoubleDict outgoing = new DoubleDict(); |
| 784 | for (int i = 0; i < size(); i++) { |
| 785 | double percent = value(i) / sum; |
| 786 | outgoing.set(key(i), percent); |
| 787 | } |
| 788 | return outgoing; |
| 789 | } |
| 790 | |
| 791 | |
| 792 | /** Returns a duplicate copy of this object. */ |