For a Java game, say I have two classes:
Player, representing a player in the game. Faction, representing a faction of players in the game.
When the game starts up, all factions are loaded into some collection and all players are loaded into some collection.
Say there are two variables:
player1 is in the faction
the_destroyers needs to reference
player1 is in
the_destroyers. At the same time,
player1 needs to reference
the_destroyers, for quick lookup (otherwise I would have to iterate through the collection of factions, which may be a very large collection).
Obviously, whichever variable is loaded first cannot reference the other, since the other has not yet been loaded.
Generally speaking, how do I get around this issue? Is there a simpler solution?