I need to create a Hallway class which will have inside 2 ArrayLists
of Stand objects , one for the stands on the right, and the other for the ones on the left.
My intention is to put these ArrayLists
inside another collection in this class.
I don't know if I should use a Hashtable, a Map, etc.
More importantly, my intention is to then access these ArrayLists using a method like:
TheHashTable["Right"].add(standObject); // Add a Stand to the Right Stands ArrayList which is inside a Hashtable.
Example:
public class Hallway {
private Hashtable< String, ArrayList<<Stand> > stands;
Hallway(){
// Create 2 ArrayList<Stand>)
this.stands.put("Right", RightStands);
this.stands.put("Left", LeftStands);
}
public void addStand(Stand s){
this.stands["Right"].add(s);
}
}
Would this be possible?