Here is my problem:
Consider that I have a big list of baseball information. Each entry in this list is a homerun a player has hit, recorded by his name and the team he was on when he hit the homerun. It would look something like:
Player | Team
tim eagles
john bears
frank lions
tim lions
frank bears
john lions
john bears
tim eagles
tim eagles
frank eagles
I am trying to understand how I would store this data in a form where each player has a list of Key:Value pairs, where K=(team name), V=(# of homeruns hit while playing for that team). This set of key:values should be ordered by # of homeruns.
This is just the way I am thinking of solving the problem, but I really have no idea if this is the best way to do it. The end goal is to be able to spit out another list of the form:
Player | Team | Homeruns
tim eagles 3
john bears 2
frank lions 1
frank eagles 1
john lions 1
tim lions 1
frank bears 1
How might I go about creating such a data structure?
My main idea so far has: ArrayList of TreeMaps where each TreeMap corresponds to a Player.