Project: Birt
Bug 238453 Code Simplification
Reported: 2008-06-25 14:17:07 | Status: resolved fixed

I had to take a look at the calculation that is used in the Mode calculation in the org.eclipse.birt.data.engine.aggregation.TotalMode class. You are using a HashMap to store data about the mode values and counts. Since the HashMap is order independent, you have to use a Counter internal class to keep track of the order that elements are inserted. Doesn't it make sense to change the implementation to use either a TreeMap or a LinkedHashMap (Java 1.5) so that you don't have to add the step of looking for first inserted item? Would this be a good HelpWanted enhancement? sr

Files changed in fix:
data/org.eclipse.birt.data.aggregation/src/org/eclipse/birt/data/aggregation/impl/TotalMode.java data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/aggregation/TotalTest.java