Ok, so I am not sure how to do this but I am sure it can be done. Here is a scenario:
I am reading in a text file that has a persons name and then the salary that they make per year for their job. The text file may look something like this:
I want to use a TreeMap to organize this so that it lists the people in alpha order. I know how to read in the text file and I write the Map as follows:
Map<String, Double> pplsWages = new TreeMap<String, Double>();
The actual code is longer but I don't think there is a need to write it because it all works. As you know, when this gets printed out it will display:
This is not what I want to happen. I want it to display David as having a wage of $55,000 and Greg as having a wage of $90,000. I want to be able to add the values together if the key is the same. I have searched around but have not come up with any answers. Any help would be much appreciated! Thanks in advance!