I am currently creating a large project, and therefore I would like everything to work out very well and as efficiently as possible.
In my project, I have a class called "Teams" that contains HashMap (Integer, Team) Team objects. Each instance of the command has a unique identifier (integer).
There is also an object called Player. Each instance of Player can be assigned to a team (but not always).
Now, I wonder what the best approach would be to know for which team the player is assigned:
-> Save the command identifier in Player (private int command), this identifier is then used to get the command from the HashMap in the commands.
-> Store a link to a command in Player (private command team)
Does anyone know which is better and what are the most important interests, problems and dangers of each of them?
Thanks!
Insdeath
source share